Of Hacks & Keyloggers…!!! “I don’t know what happened!; I don’t remember visiting any dodgy websites, downloading any weird apps, opening any suspicious emails or attachments, let alone links!, why I am receiving these sms & email notifications from my Bank!?!?” Sounds familiar right? Come to think of it, in most cases the unsuspecting victim is being honest. That being said, I just remembered something; a previous write up revolving around one of the methods used to carry out this type of attack. It can happen to anyone, in fact I was once a victim!
What is a keylogger?
A keylogger is basically a hardware device or software application that captures every key you press on your keyboard. Logging is done secretly, in such a way the victim (person using the keyboard) is unaware that their actions are being recorded or monitored. Keyloggers are usually installed to steal passwords, credit card details, personal messages, monitor network usage; basically everything one types.
Ways keyloggers get installed
There are several ways keyloggers get installed on the victim’s (affected user’s) computer but I will not be dwelling on the following;
- Hardware keyloggers that are physically installed by someone. As an example; for corporate espionage.
- Software keyloggers that are installed by a protective parent to spy on his / her child or children. In most cases, to check or monitor their online activities, that is; websites they visit, who they talk to or with; basically what they do on the affected device!
- Software keyloggers installed by a jealous / suspicious spouse to spy on his / her partner. As an example, when one suspects their spouse is cheating, to keep a tab on their whereabouts or to monitor patterns leading to strange or unusual behaviour in a marriage; e.g. when faced with sudden marital financial issues; that is, (ascertain) is he or she involved in online gambling!?
- Keyloggers installed by employers to spy on their employees. As an example, when employers want to keep a tab on what their employees are doing during working hours, some call it the “Time is money, I am paying you to work here!” approach or investigate employees they are suspicious of.
Keylogger Attack vectors
In this post I will be focusing on software based keyloggers; to be specific, keyloggers that are covertly installed on one’s computer in the form of malware. Malware is short for “malicious software”. All attack vectors involve the keylogger being delivered and installed / executed in the form of malware. The Malware usually comes in two forms, that is, one that already (armed) has keylogging capabilities or one that installs a backdoor that enables the attacker to remotely take over & control your machine and carry out malicious activities, one of them being, that which allows them to run a keylogger remotely. The installation of malware can done through the following vectors (to name a few);
- Social Engineering – Phishing, an attempt that involves tricking the victim into disclosing private information by opening a malicious email; attacker poses as a trustworthy entity in an electronic communication. Malware with keylogging capabilities is usually disguised in the email attachment or link and is installed once you open, either the malicious attachment or click on the infected link in the email body.
- Drive-by downloads – Involves victim unintentionally receiving data (downloading) from the internet to their local machine (Note: local machine can be a computer, laptop or mobile device). The silent download takes place when an unsuspecting individual visits, surfs, browses or drives-by a compromised or malicious web page. Of major concern is, most of these drive-by downloads (with keylogging capabilities) are placed in normal and decent looking websites.
- Downloading & installing software from unknown or untrusted sources – This is one of the most common ways of getting malicious software onto your computer. You download that file (executable program), that cracked game you love playing the most onto your machine but little do you know it also comes with a backdoor / malicious piece of code with keylogging capabilities. Untrusted sources can also involve the installation of malicious ‘backdoor’ed’ applications from External media like Flash Drives.
- Man-in-the-middle (MitM) Attack – takes place on poorly secured Local Area Networks (LAN) or WiFi’s, usually Public WiFi’s, or even your poorly secured Home or work WiFi router; it involves the Attacker (also) connecting to the same WiFi (or network) and scanning for certain weakness such as default passwords, poorly configured services or application vulnerabilities on the same network. Once vulnerabilities are found, they insert themselves between the user’s computer and websites the user visits and intercept the traffic between the two.
- Vulnerable machines connected to the Internet or Local Network – Connecting that unpatched & outdated machine of yours directly to the internet or local network; (which is even) made a lot easier if the following are met (to name a few);
- The victim is not behind a firewall; in the event they are behind one, usually behind a poorly secured / configured one.
- The victim runs outdated, unsupported & unpatched software applications / programs on their PC e.g. Outdated web browser, unsupported Operating System (O.S) – Windows XP!!!
- The victim does not have any robust Antivirus or anti-spyware software running on their machine.
- The user just downloads & installs any software, clicks on any links, accepts and opens any & every email & social media requests on their computer.
How keyloggers work
Without being too technical, the main objective behind keyloggers is to get in between (interface) any two (2) links in the chain of processes or events between when a key is pressed and when information about that key punch / keystroke is displayed on the monitor / screen.
How they do it
Below is a demonstration of how an attacker could remotely carry out this attack on an unsuspecting victim’s computer, that is, directly connected to the internet and running outdated & unpatched (vulnerable) software applications / programs. Please Note; the Hack was carried out over the Internet. Both tests (Local & Remote) are in controlled and authorised environments! Do not try this on machines you are not authorised to access; it is illegal and I will not be held liable for any policy breaches & damages caused!
As can be seen on the left (Click image to enlarge). The Victim (named Mr X whose name we will see shortly, in the next screenshot) is currently logged onto a vulnerable computer (also shown in the next screenshot) with the following information;
Computer Name: Placebo
I.P Address: 184.108.40.206
Software (O.S): Computer is running Windows 7 Ultimate
NOTE: A screenshot of the current desktop can also be taken remotely by the Attacker!
Following a successful attack on the Victim’s PC (Placebo) whose currently logged on user is Mr X over the Internet (Wide Area Network (WAN)), we can see that there is a connect back connection from the victim’s machine to the attacker (Attacker’s Internal I.P Address is: 192.168.5.253). Successfully exploiting the victim’s machine enables the attacker to take over and control the victim’s machine.
The attacker’s machine sits behind a robust firewall that logs incoming & outgoing traffic. As can be seen in the firewall logs, a (connect back) connection was successfully initiated from the victim’s machine sitting somewhere (remote) to the Attacker’s machine, over the internet.
What does all this mean?
In a nutshell, the following sequence of events happened (took place); that led to the victim being compromised:
- Attacker sets out on a mission to look for a vulnerable machine on the internet, if found, exploit and take control of it.
- Attack can be random or targeted at a specific machine or machines (victim). Targeted machine has to meet specific requirements in order for the attack to be successful.
- Attacker requires a Windows machine that is susceptible to a particularly known vulnerability (to exploit), procedure resembling an earlier post (Windows XP Hack). In this case, exploit is one only found on a Windows 7 machine (vulnerable), that is, one that is not patched (updated) with a specific update that addresses (prevents) this particular weakness that is going to be taken advantage of.
- Attacker arms his exploit (exploit is a piece of code that takes advantage of a particular weakness / flaw in a system’s application or service, usually for malicious purposes), which he / she further arms with a specific payload (payload is a piece of software that carries out a specific function (executes a malicious activity) once a particular machine has been exploited), in this case a reverse shell.
- A reverse shell is a user interface for accessing the operating system’s services, which connects back from victim (target) to attacking machine.
- Attacker explicitly specifies the connect back details of his attacking machine so victim dials back home. That is, connects back to that specific machine on the internet.
- Exploit can be delivered using “keylogger Attack Vector” methods specified above!
- In the above case, the Attacker manages to get the Victim’s machine to connect back to his / her machine. The situation enables the Attacker to remotely access the Victim’s “Command Prompt” on his local machine, similar to a scenario where it’s like one is actually sitting in front of the victim’s physical machine (despite them being geographically apart).
That being said, in recent years there has been a rapid increase in the use of Keyloggers by Cyber criminals! Are you safe?
Shell access is just the beginning! The worst is yet to come! In Part 2, I will be demonstrating how the Attacker proceeds to remotely launch a keylogger that captures all the Victim’s keystrokes! Say what!? Yes you heard me, I said the good news is, there are ways to protect yourself from keyloggers!