Ransomware

MS-ISAC Primer – Ransomware

Overview

Ransomware is a type of malware that blocks access to a system, device, or file until a ransom is paid. This almost always occurs when the ransomware encrypts files on the infected system (crypto ransomware), although a few variants are known to erase files or block access to the system using other methods (locker ransomware). The cyber threat actors behind ransomware most commonly demand that the victim pays $200 to $1,000 in bitcoins, though other currencies, gift cards, and ransoms of up to several thousand dollars are occasionally reported. Ransomware almost always involves opportunistic targeting, with dissemination through malvertising or spam emails containing malicious attachments. In the past several months, MS-ISAC has become aware of several ransomware variants that include additional, independent components, such as data exfiltration, participation in distributed denial of service (DDoS) attacks, and anti-detection components.

Recommendations

Securing Networks and Systems

  • Know what is connected to and running on your network. Keep all hardware, operating systems, applications, and software up-to-date and patched.
  • Use antivirus programs with automatic updates of signatures and software.
  • Perform regular backups of all systems to limit the impact of data loss, and store the backups offline as some ransomware is able to encrypt backup files if they are connected to the network. Use a backup system that allows multiple iterations of the backups to be saved, in case a copy of the backups includes encrypted or infected files. Verify the backups are operational. Rebuilding or re-imaging an infected system from a known good backup or fresh installation is the only known way to guarantee an infection has been removed from a system.
  • Implement an anti-spam solution to help stop phishing emails from reaching the network. Consider adding a warning banner to all emails from external sources that reminds users of the dangers of clicking on links and opening attachments. If possible, disable the use of macro scripts in Office.
  • Apply the Principle of Least Privilege and consider implementing network segmentation.
  • Consider the use of a proxy server for Internet access and/or ad blocking software.
  • Implement software restriction policies or other controls to prevent unauthorized programs from executing, especially when stored in locations frequently used by malware, such as temporary folders.
  • If possible, use virtual environments as they help provide isolation and enable faster recovery.
  • Vet and monitor third parties that have remote access into the organization’s network and/or your connections to third parties, to ensure they are diligent with cybersecurity best practices.
  • Consider disabling user access to personal webmail and social media accounts.
  • Ensure that staff know where and how to report suspicious emails and possible infections.

Securing the End User

  • Provide social engineering and phishing training to employees. Urge them not to open suspicious emails, not to click links contained in such emails, not to post sensitive information online, and to never provide usernames and/or passwords to any unsolicited request.

Responding to a Compromise/Attack

  • Unplug the infected systems from the network to prevent further infections.
  • Restore files from regularly maintained backups.

 

The MS-ISAC is the focal point for cyber threat prevention, protection, response, and recovery for the nation’s state, local, tribal, and territorial (SLTT) governments. More information about this topic, as well as 24/7 cybersecurity assistance for SLTT governments, is available at 866-787-4722, SOC@cisecurity.org, orhttps://msisac.cisecurity.org/. The MS-ISAC is interested in your comments – an anonymous feedback survey is available at:https://www.surveymonkey.com/r/MSISACProductEvaluation.

For more information, you can navigate to CIS Website.

SQL INJECTION 2

Finding SQLi Vulnerable Websites in a Web Server

SQL Injection (SQLi) vulnerability is not new and is one of the most dangerous vulnerabilities present in web applications . SQL injection is a very dangerous vulnerability and can lead to stealing of the data or even complete defacement of the website .

If anyone is targeting your website , it is not essential that they do so by attacking your website directly . What they can do is to look for SQL Injection vulnerability on any of the websites on your server or your IP . Once the server has been compromised , the websites hosted on it can also be compromised . Here is a trick to analyse the server for SQL injection vulnerabilities in the websites hosted on them .

During our Penetration Testing we often come across scenarios where we have to check the web sever for vulnerabilities . We might only be liable for penetration testing only the website , though sometimes other websites hosted on the same server might be vulnerable which imposes a threat to our target website too. So this post might be a guide to the penetration testers for quickly checking the web-server for any other websites hosted if vulnerable to SQL Injection .

First Thing we need to do is to get the IP address of the Website . For this you can simply Ping the website using command prompt in Windows or Terminal in Linux.

Now at this step we are aware of two things : The Domain of the website and IP address of the Website .

We need the help of an external tool here . What we exactly want is to Identify the websites hosted on this IP address. Luckily we have a website to our rescue . Yougetsignal.com . 

Please click on this link to find the other websites hosted on this web server .

This windows will give you the list of all the domains hosted on this web-server . All we need to do to find which of these websites is vulnerable to SQL Injection .

Open Bing Search Engine : 

In Search box type ip:x.x.x.x php?id= and click on search icon.
Must replace x.x.x.x with your selected server IP.

After that bing will search the sites which have extension php?id= like this  www.site.com/index.php?id=  and it will give u a list of sites which ends with this extension php?id= .

Now select any of one site and add ‘ after the url to check wheather site is vulnerable to SQL injection or not. If site is vunerable then its good if not then check other site from search result.

If found any site vulnerable to sql then Hack it using SQL Exploiter tools.

Else you can simple search for Google Dork files, which is a collection of websites vulnerable to SQL injection.

SQL INJECTION 1

SQL in Web Pages

In the previous chapters, you have learned to retrieve (and update) database data, using SQL.

When SQL is used to display data on a web page, it is common to let web users input their own search values.

Since SQL statements are text only, it is easy, with a little piece of computer code, to dynamically change SQL statements to provide the user with selected data:

Server Code

txtUserId = getRequestString(“UserId“);
txtSQL = “SELECT * FROM Users WHERE UserId= ” + txtUserId;

The example above, creates a select statement by adding a variable (txtUserId) to a select string. The variable is fetched from the user input (Request) to the page.

The rest of this chapter describes the potential dangers of using user input in SQL statements.

SQL Injection

SQL injection is a technique where malicious users can inject SQL commands into an SQL statement, via web page input.

Injected SQL commands can alter SQL statement and compromise the security of a web application.

SQL Injection Based on 1=1 is Always True

Look at the example above, one more time.

Let’s say that the original purpose of the code was to create an SQL statement to select a user with a given user id.

If there is nothing to prevent a user from entering “wrong” input, the user can enter some “smart” input like this:

UserId: 
105 or 1=1 in a form provided.

Server Result

SELECT * FROM Users WHEREUserId= 105 or 1=1;

The SQL above is valid. It will return all rows from the table Users, since WHERE 1=1 is always true.

Does the example above seem dangerous? What if the Users table contains names and passwords?

The SQL statement above is much the same as this:

SELECT UserId, Name, Password FROM Users WHEREUserId= 105 or 1=1;

A smart hacker might get access to all the user names and passwords in a database by simply inserting 105 or 1=1 into the input box.

SQL Injection Based on “”=”” is Always True

Here is a common construction, used to verify user login to a web site:

User Name: James Morearity

Password: Blackwaters

Server Code

uName = getRequestString(“UserName”);
uPass = getRequestString(“UserPass“);

sql = ‘SELECT * FROM Users WHERE Name =”‘ +uName + ‘” AND Pass =”‘ + uPass + ‘”‘

Result

SELECT * FROM Users WHEREName =”John Doe” AND Pass =”myPass

A smart hacker might get access to user names and passwords in a database by simply inserting ” or “”=” into the user name or password text box:

User Name: ” or “”=”

Password: ” or “”=”

The code at the server will create a valid SQL statement like this:

Result

SELECT * FROM Users WHEREName =”” or “”=”” AND Pass =”” or “”=””

The result SQL is valid. It will return all rows from the table Users, since WHERE “”=”” is always true.

SQL Injection Based on Batched SQL Statements 

Most databases support batched SQL statement, separated by semicolon.

Example

SELECT * FROM Users; DROPTABLE Suppliers

The SQL above will return all rows in the Users table, and then delete the table called Suppliers.

If we had the following server code:

Server Code

txtUserId = getRequestString(“UserId”);
txtSQL = “SELECT * FROM Users WHERE UserId= ” + txtUserId;

And the following input:

User id: 105; DROP TABLE Suppliers

The code at the server would create a valid SQL statement like this:

Result

SELECT * FROM Users WHEREUserId = 105; DROP TABLESuppliers

Parameters for Protection

Some web developers use a “blacklist” of words or characters to search for in SQL input, to prevent SQL injection attacks.

This is not a very good idea. Many of these words (like delete or drop) and characters (like semicolons and quotation marks), are used in common language, and should be allowed in many types of input.

(In fact it should be perfectly legal to input an SQL statement in a database field.)

The only proven way to protect a web site from SQL injection attacks, is to use SQL parameters.

SQL parameters are values that are added to an SQL query at execution time, in a controlled manner.

ASP.NET Razor Example

txtUserId = getRequestString(“UserId”);
txtSQL = “SELECT * FROM Users WHERE UserId = @0”;
db.Execute(txtSQL,txtUserId);

Note that parameters are represented in the SQL statement by a @ marker.

The SQL engine checks each parameter to ensure that it is correct for its column and are treated literally, and not as part of the SQL to be executed.

Another Example

txtNam = getRequestString(“CustomerName”);
txtAdd = getRequestString(“Address”);
txtCit = getRequestString(“City”);
txtSQL = “INSERT INTO Customers (CustomerName,Address,City) Values(@0,@1,@2)”;
db.Execute(txtSQL,txtNam,txtAdd,txtCit);

Examples

The following examples shows how to build parameterized queries in some common web languages.

SELECT STATEMENT IN ASP.NET:

txtUserId = getRequestString(“UserId”);
sql = “SELECT * FROM Customers WHERE CustomerId = @0”;
command = new SqlCommand(sql);
command.Parameters.AddWithValue(“@0”,txtUserID);
command.ExecuteReader();

INSERT INTO STATEMENT IN ASP.NET:

txtNam = getRequestString(“CustomerName”);
txtAdd = getRequestString(“Address”);
txtCit = getRequestString(“City”);
txtSQL = “INSERT INTO Customers (CustomerName,Address,City) Values(@0,@1,@2)”;
command = new SqlCommand(txtSQL);
command.Parameters.AddWithValue(“@0”,txtNam);
command.Parameters.AddWithValue(“@1”,txtAdd);
command.Parameters.AddWithValue(“@2”,txtCit);
command.ExecuteNonQuery();

INSERT INTO STATEMENT IN PHP:

$stmt = $dbh->prepare(“INSERT INTO Customers (CustomerName,Address,City) 
VALUES (:nam, :add, :cit)”);
$stmt->bindParam(‘:nam’, $txtNam);
$stmt->bindParam(‘:add’, $txtAdd);
$stmt->bindParam(‘:cit’, $txtCit);
$stmt->execute();

WHAT IS A VPN?

You’re watching a movie. A criminal is trying to evade a crime scene in a sports car on the highway. A helicopter is following the car from above. The car enters a tunnel with multiple exits and the helicopter loses track of the car.

A VPN works just like the tunnel in this movie scene — it connects different roads and turns them into one, and a helicopter can’t see what’s happening inside the tunnel.
I’m sure many people around you have recommended you a VPN service. They usually tell you that a VPN is great, it lets you watch geo-blocked content, avoid the Great Firewall of China or browse the internet securely. VPNs are great, sometimes. But using a VPN can be as dangerous as not using one if you don’t know what you’re doing.

What really is it?
If you have multiple computers, phones and tablets at home, you are using a local area network. These devices are all connected to the same Wi-Fi network and you can even transfer photos or movies from one computer to another without using the internet. Local area networks are private networks by design.

A VPN is a virtual private network. It lets you remotely connect to a private network. For instance, your office might be using a VPN for remote employees. This way, you can establish a connection with your company’s intranet and use your computer as if it were in the office. You’re virtually in the office, using your company’s Wi-Fi network.

Using a VPN is quite simple. Usually, a company or a developer installs a VPN server on a computer at home, in your office or in a data center. Then, users with the right credentials can connect to this server using a VPN client. There are many VPN clients out there on computers, mobile devices and even routers. Windows, Android, iOS and macOS even come with a basic VPN client in your device’s settings.

Let’s say you’re establishing a VPN connection on your computer. Your computer and the VPN server will start a point-to-point connection and all your network traffic will go through this connection. Think about this connection as a tunnel between your computer and a server. This tunnel is usually encrypted, and everything goes through the tunnel, from one end to another.

Why should I use a VPN?
Many of you probably first started using a VPN for work, especially when you’re working from home. There are a few advantages in using a VPN for a company. For example, it lets employees access office servers that aren’t connected to the internet, as you’re all connected to the same private network. Back in the days before cloud-hosted Office 365 servers or the G Suite, many companies were managing their own email and calendar servers. IT services could force you to connect to the company’s VPN first to access your emails and calendar events. It’s a good way to protect sensitive information.

But there are a few drawbacks as well. When you use a VPN connection, all network traffic goes through the VPN, including your internet traffic. Your company’s IT service could enforce strict browsing rules and prevent you from using Twitter. Or they could even watch and record your internet browsing habits to find a good excuse to fire you later down the road (too much Reddit, kthxbye).

But office environments aren’t the only use case for a VPN. If you live outside of the U.S., you know that a VPN can save the day when you’re trying to stream something from HBO Now, Netflix’s U.S. movie library, Hulu or one of the many streaming services that restrict you from using them abroad.

Many companies provide access to a bunch of servers around the world so that you can pretend you’re in another country. As I told you, once you set up a VPN connection, all network traffic goes through a tunnel and HBO’s servers will think that they’re sending data to a customer in the U.S. They’re sending data to an American IP address indeed (the address of the server), but everything is then sent through the VPN tunnel to your device on the other side of the world.

Sometimes, the VPN server doesn’t have enough bandwidth to upload the movie through the tunnel in a good resolution and your movie will look like crap. Sometimes, content companies like Netflix try to ban IP addresses that belong to well-known VPN servers, rendering this trick useless.

And finally, if you’ve traveled to China or another country that blocks many internet services, you’ve been relying on a VPN to connect to Gmail, Facebook or Twitter. China blocks websites at the network level. You need to connect to a VPN server outside of China to access those websites. Just like Netflix, the Chinese government tries to ban IP addresses of popular VPN services, making it more difficult to establish a reliable connection with a server outside of China.

Why should I use a VPN to be secure on the Internet?
Many coffee shops or hotels don’t spend too much time securing their Wi-Fi networks. Just like at home, it means that a user can see another user’s computer on the local network. And if there’s a hacker in your favorite coffee shop, they could snoop on your internet traffic to learn some information about you.

This was a serious issue a few years ago. Many websites didn’t use a secure connection on their login page. Hackers could get your bank account’s login and password and steal all your money.

Not using the Wi-Fi network at all was the best way to avoid that. But if you really needed to checked your email account, you could use a trustworthy VPN server to prevent snooping — nobody can see what’s happening in the tunnel.

Things have changed quite a lot. Now, a vast majority of internet services have switched to HTTPS and end-to-end encryption to make sure that nobody can see your private information, even without a VPN.

All of this leads me to today’s false assumptions about VPNs. No, a VPN doesn’t mean that you’ll be more secure on the internet. It depends on the VPN server.

When you use a VPN to change your country, avoid censorship or protect your connection in a coffee shop, the VPN server at the other end can see all your network traffic. You’re just moving the risk down the VPN tunnel, and it can be quite dangerous if you’re not careful enough.

Assume that all the free VPN apps that you see in the App Store and Google Play are free for a reason. They’ll analyze your browsing habits, sell them to advertisers, inject their own ads on non-secure pages or steal your identity. You should avoid free VPNs at all costs.

And even if the privacy policy looks good, you’ll have to blindly trust them as it’s hard to verify that they actually do what they promise they’re doing. In many cases, a secure home connection with a MAC address whitelist is better than connecting to some random company’s VPN server. You don’t want to give a stranger your home keys even if they say that they promise they won’t break into your house.

As for encryption, some protocols aren’t as secure as you might think. L2TP with a pre-shared key for authentication can be decrypted for instance, destroying the concept of the unbreachable tunnel. A secure server running OpenVPN with a server certificate is more robust.

All of this might sound a bit complicated, but the bottom line is quite simple: a VPN is great and can fill different needs, but don’t do business with someone shady.