Keystroke logging explained

Keystroke logging, often referred to as keylogging or keyboard capturing, is the action of recording (logging) the keys struck on a keyboard,[1] [2] typically covertly, so that a person using the keyboard is unaware that their actions are being monitored. Data can then be retrieved by the person operating the logging program. A keystroke recorder or keylogger can be either software or hardware.

While the programs themselves are legal,[3] with many designed to allow employers to oversee the use of their computers, keyloggers are most often used for stealing passwords and other confidential information.[4] [5] Keystroke logging can also be utilized to monitor activities of children in schools or at home and by law enforcement officials to investigate malicious usage.[6]

Keylogging can also be used to study keystroke dynamics[7] or human-computer interaction. Numerous keylogging methods exist, ranging from hardware and software-based approaches to acoustic cryptanalysis.

History

In the mid-1970s, the Soviet Union developed and deployed a hardware keylogger targeting typewriters. Termed the "selectric bug", it measured the movements of the print head of IBM Selectric typewriters via subtle influences on the regional magnetic field caused by the rotation and movements of the print head.[8] An early keylogger was written by Perry Kivolowitz and posted to the Usenet newsgroup net.unix-wizards, net.sources on November 17, 1983.[9] The posting seems to be a motivating factor in restricting access to /dev/kmem on Unix systems. The user-mode program operated by locating and dumping character lists (clients) as they were assembled in the Unix kernel.

In the 1970s, spies installed keystroke loggers in the US Embassy and Consulate buildings in Moscow.[10] [11] They installed the bugs in Selectric II and Selectric III electric typewriters.[12]

Soviet embassies used manual typewriters, rather than electric typewriters, for classified information—apparently because they are immune to such bugs.As of 2013, Russian special services still use typewriters.[13] [14]

Application of keylogger

Software-based keyloggers

A software-based keylogger is a computer program designed to record any input from the keyboard.[15] Keyloggers are used in IT organizations to troubleshoot technical problems with computers and business networks. Families and businesspeople use keyloggers legally to monitor network usage without their users' direct knowledge. Microsoft publicly stated that Windows 10 has a built-in keylogger in its final version "to improve typing and writing services".[16] However, malicious individuals can use keyloggers on public computers to steal passwords or credit card information. Most keyloggers are not stopped by HTTPS encryption because that only protects data in transit between computers; software-based keyloggers run on the affected user's computer, reading keyboard inputs directly as the user types.

From a technical perspective, there are several categories:

Keystroke logging in writing process research

Since 2006, Keystroke logging has been an established research method for the study of writing processes.[21] [22] Different programs have been developed to collect online process data of writing activities,[23] including Inputlog, Scriptlog, Translog and GGXLog.

Keystroke logging is used legitimately as a suitable research instrument in several writing contexts. These include studies on cognitive writing processes, which include

Keystroke logging can be used to research writing, specifically. It can also be integrated into educational domains for second language learning, programming skills, and typing skills.

Related features

Software keyloggers may be augmented with features that capture user information without relying on keyboard key presses as the sole input. Some of these features include:

Hardware-based keyloggers

See main article: Hardware keylogger. Hardware-based keyloggers do not depend upon any software being installed as they exist at a hardware level in a computer system.

Cracking

Writing simple software applications for keylogging can be trivial, and like any nefarious computer program, can be distributed as a trojan horse or as part of a virus. What is not trivial for an attacker, however, is installing a covert keystroke logger without getting caught and downloading data that has been logged without being traced. An attacker that manually connects to a host machine to download logged keystrokes risks being traced. A trojan that sends keylogged data to a fixed e-mail address or IP address risks exposing the attacker.

Trojans

Researchers Adam Young and Moti Yung discussed several methods of sending keystroke logging. They presented a deniable password snatching attack in which the keystroke logging trojan is installed using a virus or worm. An attacker who is caught with the virus or worm can claim to be a victim. The cryptotrojan asymmetrically encrypts the pilfered login/password pairs using the public key of the trojan author and covertly broadcasts the resulting ciphertext. They mentioned that the ciphertext can be steganographically encoded and posted to a public bulletin board such as Usenet.[44] [45]

Use by police

In 2000, the FBI used FlashCrest iSpy to obtain the PGP passphrase of Nicodemo Scarfo, Jr., son of mob boss Nicodemo Scarfo.[46] Also in 2000, the FBI lured two suspected Russian cybercriminals to the US in an elaborate ruse, and captured their usernames and passwords with a keylogger that was covertly installed on a machine that they used to access their computers in Russia. The FBI then used these credentials to gain access to the suspects' computers in Russia to obtain evidence to prosecute them.[47]

Countermeasures

The effectiveness of countermeasures varies because keyloggers use a variety of techniques to capture data and the countermeasure needs to be effective against the particular data capture technique. In the case of Windows 10 keylogging by Microsoft, changing certain privacy settings may disable it.[48] An on-screen keyboard will be effective against hardware keyloggers; transparency will defeat some—but not all—screen loggers. An anti-spyware application that can only disable hook-based keyloggers will be ineffective against kernel-based keyloggers.

Keylogger program authors may be able to update their program's code to adapt to countermeasures that have proven effective against it.

Anti-keyloggers

See main article: Anti-keylogger. An anti-keylogger is a piece of software specifically designed to detect keyloggers on a computer, typically comparing all files in the computer against a database of keyloggers, looking for similarities which might indicate the presence of a hidden keylogger. As anti-keyloggers have been designed specifically to detect keyloggers, they have the potential to be more effective than conventional antivirus software; some antivirus software do not consider keyloggers to be malware, as under some circumstances a keylogger can be considered a legitimate piece of software.[49]

Live CD/USB

Rebooting the computer using a Live CD or write-protected Live USB is a possible countermeasure against software keyloggers if the CD is clean of malware and the operating system contained on it is secured and fully patched so that it cannot be infected as soon as it is started. Booting a different operating system does not impact the use of a hardware or BIOS based keylogger.

Anti-spyware / Anti-virus programs

Many anti-spyware applications can detect some software based keyloggers and quarantine, disable, or remove them. However, because many keylogging programs are legitimate pieces of software under some circumstances, anti-spyware often neglects to label keylogging programs as spyware or a virus. These applications can detect software-based keyloggers based on patterns in executable code, heuristics and keylogger behaviors (such as the use of hooks and certain APIs).

No software-based anti-spyware application can be 100% effective against all keyloggers.[50] Software-based anti-spyware cannot defeat non-software keyloggers (for example, hardware keyloggers attached to keyboards will always receive keystrokes before any software-based anti-spyware application).

The particular technique that the anti-spyware application uses will influence its potential effectiveness against software keyloggers. As a general rule, anti-spyware applications with higher privileges will defeat keyloggers with lower privileges. For example, a hook-based anti-spyware application cannot defeat a kernel-based keylogger (as the keylogger will receive the keystroke messages before the anti-spyware application), but it could potentially defeat hook- and API-based keyloggers.

Network monitors

Network monitors (also known as reverse-firewalls) can be used to alert the user whenever an application attempts to make a network connection. This gives the user the chance to prevent the keylogger from "phoning home" with their typed information.

Automatic form filler programs

See main article: Form filler. Automatic form-filling programs may prevent keylogging by removing the requirement for a user to type personal details and passwords using the keyboard. Form fillers are primarily designed for Web browsers to fill in checkout pages and log users into their accounts. Once the user's account and credit card information has been entered into the program, it will be automatically entered into forms without ever using the keyboard or clipboard, thereby reducing the possibility that private data is being recorded. However, someone with physical access to the machine may still be able to install software that can intercept this information elsewhere in the operating system or while in transit on the network. (Transport Layer Security (TLS) reduces the risk that data in transit may be intercepted by network sniffers and proxy tools.)

One-time passwords (OTP)

Using one-time passwords may prevent unauthorized access to an account which has had its login details exposed to an attacker via a keylogger, as each password is invalidated as soon as it is used. This solution may be useful for someone using a public computer. However, an attacker who has remote control over such a computer can simply wait for the victim to enter their credentials before performing unauthorized transactions on their behalf while their session is active.

Another common way to protect access codes from being stolen by keystroke loggers is by asking users to provide a few randomly selected characters from their authentication code. For example, they might be asked to enter the 2nd, 5th, and 8th characters. Even if someone is watching the user or using a keystroke logger, they would only get a few characters from the code without knowing their positions.[51]

Security tokens

Use of smart cards or other security tokens may improve security against replay attacks in the face of a successful keylogging attack, as accessing protected information would require both the (hardware) security token as well as the appropriate password/passphrase. Knowing the keystrokes, mouse actions, display, clipboard, etc. used on one computer will not subsequently help an attacker gain access to the protected resource. Some security tokens work as a type of hardware-assisted one-time password system, and others implement a cryptographic challenge–response authentication, which can improve security in a manner conceptually similar to one time passwords. Smartcard readers and their associated keypads for PIN entry may be vulnerable to keystroke logging through a so-called supply chain attack[52] where an attacker substitutes the card reader/PIN entry hardware for one which records the user's PIN.

On-screen keyboards

Most on-screen keyboards (such as the on-screen keyboard that comes with Windows XP) send normal keyboard event messages to the external target program to type text. Software key loggers can log these typed characters sent from one program to another.[53]

Keystroke interference software

Keystroke interference software is also available.[54] These programs attempt to trick keyloggers by introducing random keystrokes, although this simply results in the keylogger recording more information than it needs to. An attacker has the task of extracting the keystrokes of interest—the security of this mechanism, specifically how well it stands up to cryptanalysis, is unclear.

Speech recognition

Similar to on-screen keyboards, speech-to-text conversion software can also be used against keyloggers, since there are no typing or mouse movements involved. The weakest point of using voice-recognition software may be how the software sends the recognized text to target software after the user's speech has been processed.

Handwriting recognition and mouse gestures

Many PDAs and lately tablet PCs can already convert pen (also called stylus) movements on their touchscreens to computer understandable text successfully. Mouse gestures use this principle by using mouse movements instead of a stylus. Mouse gesture programs convert these strokes to user-definable actions, such as typing text. Similarly, graphics tablets and light pens can be used to input these gestures, however, these are becoming less common.

The same potential weakness of speech recognition applies to this technique as well.

Macro expanders/recorders

With the help of many programs, a seemingly meaningless text can be expanded to a meaningful text and most of the time context-sensitively, e.g. "en.wikipedia.org" can be expanded when a web browser window has the focus. The biggest weakness of this technique is that these programs send their keystrokes directly to the target program. However, this can be overcome by using the 'alternating' technique described below, i.e. sending mouse clicks to non-responsive areas of the target program, sending meaningless keys, sending another mouse click to the target area (e.g. password field) and switching back-and-forth.

Deceptive typing

Alternating between typing the login credentials and typing characters somewhere else in the focus window[55] can cause a keylogger to record more information than it needs to, but this could be easily filtered out by an attacker. Similarly, a user can move their cursor using the mouse while typing, causing the logged keystrokes to be in the wrong order e.g., by typing a password beginning with the last letter and then using the mouse to move the cursor for each subsequent letter. Lastly, someone can also use context menus to remove, cut, copy, and paste parts of the typed text without using the keyboard. An attacker who can capture only parts of a password will have a larger key space to attack if they choose to execute a brute-force attack.

Another very similar technique uses the fact that any selected text portion is replaced by the next key typed. e.g., if the password is "secret", one could type "s", then some dummy keys "asdf". These dummy characters could then be selected with the mouse, and the next character from the password "e" typed, which replaces the dummy characters "asdf".

These techniques assume incorrectly that keystroke logging software cannot directly monitor the clipboard, the selected text in a form, or take a screenshot every time a keystroke or mouse click occurs. They may, however, be effective against some hardware keyloggers.

See also

Notes and References

  1. Nyang. DaeHun. Mohaisen. Aziz. Kang. Jeonil. 2014-11-01. Keylogging-Resistant Visual Authentication Protocols. IEEE Transactions on Mobile Computing. 13. 11. 2566–2579. 10.1109/TMC.2014.2307331. 8161528. 1536-1233.
  2. Conijn . Rianne . Cook . Christine . van Zaanen . Menno . Van Waes . Luuk . 2021-08-24 . Early prediction of writing quality using keystroke logging . International Journal of Artificial Intelligence in Education . 32 . 4 . 835–866 . en . 10.1007/s40593-021-00268-w . 238703970 . 1560-4292. free . 10067/1801420151162165141 . free .
  3. https://www.keylogger.org/keylogger.html#h_8 Use of legal software products for computer monitoring
  4. Web site: Keylogger. Oxford dictionaries. 2013-08-03. 2013-09-11. https://web.archive.org/web/20130911175015/http://oxforddictionaries.com/definition/english/keylogger. dead.
  5. https://securelist.com/keyloggers-how-they-work-and-how-to-detect-them-part-1/36138/ Keyloggers: How they work and how to detect them (Part 1)
  6. Book: Rai . Swarnima . Choubey . Vaaruni . Suryansh . Garg . Puneet . A Systematic Review of Encryption and Keylogging for Computer System Security . 2022-07-08 . 2022 Fifth International Conference on Computational Intelligence and Communication Technologies (CCICT) . https://ieeexplore.ieee.org/document/9913618 . IEEE . 157–163 . 10.1109/CCiCT56684.2022.00039 . 978-1-6654-7224-1. 252849669 .
  7. Stefan, Deian, Xiaokui Shu, and Danfeng Daphne Yao. "Robustness of keystroke-dynamics based biometrics against synthetic forgeries." computers & security 31.1 (2012): 109-121.
  8. Web site: Selectric bug .
  9. Web site: The Security Digest Archives . 2009-11-22.
  10. Web site: Soviet Spies Bugged World's First Electronic Typewriters . dead . https://web.archive.org/web/20131220110339/http://www.qccglobal.com/news/first-keystroke-logger.php . 2013-12-20 . 2013-12-20 . qccglobal.com.
  11. Geoffrey Ingersoll."Russia Turns To Typewriters To Protect Against Cyber Espionage".2013.
  12. Sharon A. Maneki."Learning from the Enemy: The GUNMAN Project" .2012.
  13. Web site: Agence France-Presse, Associated Press . 13 July 2013 . Wanted: 20 electric typewriters for Russia to avoid leaks . inquirer.net.
  14. Anna Arutunyan."Russian security agency to buy typewriters to avoid surveillance" .
  15. Web site: What is a Keylogger?. PC Tools.
  16. Web site: Microsoft Windows 10 has a keylogger enabled by default – here's how to disable it. Caleb Chen. 2017-03-20.
  17. The Evolution of Malicious IRC Bots. https://web.archive.org/web/20060315074124/http://www.symantec.com/avcenter/reference/the.evolution.of.malicious.irc.bots.pdf. dead. March 15, 2006. Symantec. 2005-11-26. 2011-03-25. 23–24.
  18. Bypassing pre-boot authentication passwords by instrumenting the BIOS keyboard buffer (practical low level attacks against x86 pre-boot authentication software). 2008-09-03. 2008-09-23. Jonathan Brossard. www.ivizsecurity.com. dead. https://web.archive.org/web/20080913072014/http://www.ivizsecurity.com/research/preboot/preboot_whitepaper.pdf. 2008-09-13.
  19. News: Web-Based Keylogger Used to Steal Credit Card Data from Popular Sites. 2016-10-06. Threatpost The first stop for security news. en-US. 2017-01-24.
  20. News: SpyEye Targets Opera, Google Chrome Users. 26 April 2011. Krebs on Security.
  21. K.P.H. Sullivan & E. Lindgren (Eds., 2006), Studies in Writing: Vol. 18. Computer Key-Stroke Logging and Writing: Methods and Applications. Oxford: Elsevier.
  22. V. W. Berninger (Ed., 2012), Past, present, and future contributions of cognitive writing research to cognitive psychology. New York/Sussex: Taylor & Francis.
  23. News: Keystroke Logging in SpyWareLoop.com . Vincentas . Spyware Loop . 11 July 2013 . 27 July 2013 . dead . https://web.archive.org/web/20131207133350/http://www.spywareloop.com/news/keystroke-logging . 7 December 2013 .
  24. Web site: EM_GETLINE Message. Microsoft. 2009-07-15. Microsoft.
  25. Web site: Apple keyboard hack. Digital Society. 9 June 2011. dead. https://web.archive.org/web/20090826150015/http://www.digitalsociety.org/2009/08/apple-keyboards-hacked-and-possessed. 26 August 2009.
  26. Web site: Keylogger Removal . SpyReveal Anti Keylogger . 25 April 2011 . dead . https://web.archive.org/web/20110429181147/http://spyreveal.com/keyloggerremoval . 29 April 2011 .
  27. Web site: Keylogger Removal. SpyReveal Anti Keylogger. 26 February 2016.
  28. News: Tampered Credit Card Terminals. Jeremy Kirk. IDG News Service. 2008-12-16. 2009-04-19.
  29. Web site: Cracking Passwords using Keyboard Acoustics and Language Modeling. Andrew Kelly. 2010-09-10.
  30. Web site: Researchers recover typed text using audio recording of keystrokes . Sarah Young . UC Berkeley NewsCenter. 14 September 2005.
  31. Web site: Knight. Will. A Year Ago: Cypherpunks publish proof of Tempest. ZDNet. en.
  32. Compromising Electromagnetic Emanations of Wired and Wireless Keyboards. Proceedings of the 18th Usenix Security Symposium. 2009-06-01. Martin Vuagnoux and Sylvain Pasini. Vuagnoux, Martin. Pasini, Sylvain.
  33. Web site: ATM camera. www.snopes.com. 19 January 2004 . 2009-04-19.
  34. Maggi . Federico . Volpatto . Alberto . Gasparini . Simone . Boracchi . Giacomo . Zanero . Stefano . 2011 7th International Conference on Information Assurance and Security (IAS) . 2011 . A fast eavesdropping attack against touchscreens . 320–325 . 7th International Conference on Information Assurance and Security . IEEE . 10.1109/ISIAS.2011.6122840 . 978-1-4577-2155-7 . http://www.syssec-project.eu/m/page-media/3/iclearshot-ias11.pdf .
  35. Marquardt . Philip . Verma . Arunabh . Carter . Henry . Traynor . Patrick . 2011 . (sp)iPhone: decoding vibrations from nearby keyboards using mobile phone accelerometers . Proceedings of the 18th ACM conference on Computer and communications security . 561–562 . ACM . 10.1145/2046707.2046771 .
  36. iPhone Accelerometer Could Spy on Computer Keystrokes . Wired . 19 October 2011. August 25, 2014.
  37. Owusu . Emmanuel . Han . Jun . Das . Sauvik . Perrig . Adrian . Zhang . Joy . 2012 . ACCessory: password inference using accelerometers on smartphones . Proceedings of the Thirteenth Workshop on Mobile Computing Systems and Applications . ACM . 10.1145/2162081.2162095 .
  38. Aviv . Adam J. . Sapp . Benjamin . Blaze . Matt . Smith . Jonathan M. . Proceedings of the 28th Annual Computer Security Applications Conference on - ACSAC '12 . 2012 . Practicality of accelerometer side channels on smartphones . 41 . Proceedings of the 28th Annual Computer Security Applications Conference . ACM . 10.1145/2420950.2420957 . 9781450313124 .
  39. Cai . Liang . Chen . Hao . 2011 . TouchLogger: inferring keystrokes on touch screen from smartphone motion . Proceedings of the 6th USENIX conference on Hot topics in security . USENIX . 25 August 2014 .
  40. Xu . Zhi . Bai . Kun . Zhu . Sencun . 2012 . TapLogger: inferring user inputs on smartphone touchscreens using on-board motion sensors . Proceedings of the fifth ACM conference on Security and Privacy in Wireless and Mobile Networks . ACM . 113–124 . 10.1145/2185448.2185465 .
  41. Miluzzo . Emiliano . Varshavsky . Alexander . Balakrishnan . Suhrid . Choudhury . Romit Roy . 2012 . Tapprints: your finger taps have fingerprints . Proceedings of the 10th international conference on Mobile systems, applications, and services . 323–336 . ACM . 10.1145/2307636.2307666 .
  42. Spreitzer . Raphael . 2014 . PIN Skimming: Exploiting the Ambient-Light Sensor in Mobile Devices . Proceedings of the 4th ACM Workshop on Security and Privacy in Smartphones & Mobile Devices . ACM . 51–62 . 10.1145/2666620.2666622. 1405.3760 .
  43. Hameiri. Paz. 2019. Body Keylogging. Hakin9 IT Security Magazine. 14. 7. 79–94.
  44. Book: Young . Adam . Yung . Moti . Proceedings. 1997 IEEE Symposium on Security and Privacy (Cat. No.97CB36097) . Deniable password snatching: On the possibility of evasive electronic espionage . 1997 . 224–235 . 10.1109/SECPRI.1997.601339 . 978-0-8186-7828-8 . 14768587 .
  45. Book: Young . Adam . Yung . Moti . Proceedings 1996 IEEE Symposium on Security and Privacy . Cryptovirology: Extortion-based security threats and countermeasures . 1996 . 129–140 . 10.1109/SECPRI.1996.502676 . 978-0-8186-7417-4 . 10.1.1.44.9122 . 12179472 .
  46. Web site: Mafia trial to test FBI spying tactics: Keystroke logging used to spy on mob suspect using PGP. 2000-12-06. 2009-04-19. The Register. John Leyden.
  47. Web site: Russians accuse FBI Agent of Hacking. The Register. 2002-08-16. John Leyden.
  48. Web site: 3 methods to disable Windows 10 built-in Spy Keylogger. Alex Stim. 2015-10-28.
  49. Web site: What is Anti Keylogger? . 23 August 2018.
  50. Creutzburg. Reiner. 2017-01-29. The strange world of keyloggers - an overview, Part I. Electronic Imaging. 2017. 6. 139–148. 10.2352/ISSN.2470-1173.2017.6.MOBMU-313.
  51. Goring . Stuart P. . Rabaiotti . Joseph R. . Jones . Antonia J. . 2007-09-01 . Anti-keylogging measures for secure Internet login: An example of the law of unintended consequences . Computers & Security . 26 . 6 . 421–426 . 10.1016/j.cose.2007.05.003 . 0167-4048.
  52. Web site: Organized crime tampers with European card swipe devices. Austin Modine. 2008-10-10. 2009-04-18. The Register.
  53. Web site: Prevent keyloggers from grabbing your passwords. Scott Dunn. 2009-09-10. 2014-05-10. Windows Secrets.
  54. Web site: Anti Keylogger . Christopher Ciabarra . 2009-06-10 . Networkintercept.com . dead . https://web.archive.org/web/20100626093658/http://networkintercept.com/keystrokeinterference.html . 2010-06-26 .
  55. Web site: How To Login From an Internet Cafe Without Worrying About Keyloggers. Microsoft Research. Cormac Herley and Dinei Florencio. 2006-02-06. 2008-09-23.