* Fixing links * Code samples (#149) * Update obfuscated-files-or-information.md Added code sample with some proposed formatting incl. annotations explaining broad behavior patterns * Update obfuscated-files-or-information.md Added brief clarification to note * Update obfuscated-files-or-information.md Made requested changes to format * Update system-information-discovery.md Added code snippet from PoisonIvy RAT * Update debugger-detection.md Added code with example of PEB access * Update system-information-discovery.md Added new method based on code snippet * Update registry.md Added snippet for registry key query * Update generate-pseudorandom-sequence.md Added example of Mersenne Twister algorithm * Update keylogging.md Add Dark Comet keylogging code sample * Update dns-communication.md Added code sample from darkcomet * Update socket-communication.md Added DarkComet code snippet * Update delete-file.md Provided DarkComet sample * Update file-and-directory-discovery.md Added DarkComet snippet * Update allocate-memory.md Added DarkComet sample * Update modulo.md Added Hupigon snippet * Update get-file-attributes.md Added Hupigon sample * Update application-window-discovery.md Added Hupigon snippet * Update create-process.md Added Hupigon snippet. * Update conditional-execution.md Added Hupigon snippet * Update create-thread.md Added Hupigon snippet * Update resume-thread.md Added Hupigon snippet * Update command-and-scripting-interpreter.md Added SmokeLoader sample * Update change-memory-protection.md Added SmokeLoader snippet * Update console.md Added snippet from SmokeLoader * Update dynamic-analysis-evasion.md Added Industroyer sample * Update interprocess-communication.md Added CobaltStrike sample * Update read-file.md Added Cobalt Strike snippet * Update writes-file.md Added cobalt strike snippet * Update noncryptographic-hash.md Added emotet snippet * Update clipboard-modification.md Added emotet snippet * Update check-mutex.md Added emotet sampler * Update check-mutex.md Fixed typo * Update create-mutex.md Added Emotet snippet * Update allocate-thread-local-storage.md Added emotet snippet * Update registry-run-keys-startup-folder.md Added emotet snippet * Update wininet.md Added EnvyScout snippet * Update http-communication.md Added EnvyScout snippet * Update enumerate-threads.md Added Envyscout snippet * Update set-thread-local-storage-value.md Added Envyscout sample * Update create-directory.md Added explosive snippet * Update delete-directory.md Added explosive code snippet (note: the malware is called "explosive") * Update set-file-attributes.md Added explosive sample * Update terminate-process.md Added explosive snippet * Update terminate-thread.md Added explosive sample * Update move-file.md Added Finfisher snippet * Update screen-capture.md Added ECCENTRICBANDWAGON snippet * Fix links (#150) * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * fix link * update mod date * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * fix links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * update links * Update code-discovery.md * Update taskbar-discovery.md * Update conditional-execution.md * Update memory-dump-evasion.md * Update execution-dependency.md * Update compromise-data-integrity.md * Update dns-communication.md * Update http-communication.md * Update interprocess-communication.md * Update socket-communication.md * Update wininet.md * Update generate-pseudorandom-sequence.md * Update modulo.md * Update noncryptographic-hash.md * Update create-directory.md * Update delete-directory.md * Update delete-file.md * Update get-file-attributes.md * Update move-file.md * Update read-file.md * Update terminate-thread.md * Update set-file-attributes.md * Update writes-file.md * Update allocate-memory.md * Update change-memory-protection.md * Update console.md * Update registry.md * Update allocate-thread-local-storage.md * Update check-mutex.md * Update terminate-process.md * Update create-mutex.md * Update create-process.md * Update set-thread-local-storage-value.md * Update resume-thread.md * Update enumerate-threads.md * Update create-thread.md * update for 3.1 release * update for 3.1 release * update for 3.1 release --------- Co-authored-by: ryan <ryanxu@wustl.edu> Co-authored-by: brightmt <50853930+brightmt@users.noreply.github.com>
5.3 KiB
| ID | F0002 |
| Objective(s) | Collection, Credential Access |
| Related ATT&CK Techniques | Input Capture: Keylogging (T1056.001, T1417.001) |
| Version | 2.3 |
| Created | 14 August 2020 |
| Last Modified | 27 April 2024 |
Keylogging
Malware captures user keyboard input.
See ATT&CK: Input Capture: Keylogging (T1056.001, T1417.001)
Methods
| Name | ID | Description |
|---|---|---|
| Application Hook | F0002.001 | Keystrokes are captured with an application hook. |
| Polling | F0002.002 | Keystrokes are captured via polling (e.g., user32.GetAsyncKeyState, user32.GetKeyState). |
Use in Malware
| Name | Date | Method | Description |
|---|---|---|---|
| Hupigon | 2013 | -- | Certain variants of the malware may have keylogging functionality. [1] |
| Hupigon | 2013 | F0002.002 | Malware logs keystrokes via polling. [9] |
| UP007 | 2016 | -- | The malware logs keystrokes to a file. [2] |
| BlackEnergy | 2007 | -- | BlackEnergy's keylogger plugin allows for the collection of keystrokes. [3] |
| DarkComet | 2008 | -- | DarkComet can capture keystrokes. [4] |
| Dark Comet | 2008 | F0002.002 | Malware logs keystrokes via polling. [9] |
| Poison Ivy | 2005 | -- | Poison Ivy can capture keystrokes. [5] |
| CHOPSTICK | 2015 | -- | CHOPSTICK collects user keystrokes. [6] |
| Kovter | 2016 | F0002.002 | Malware logs keystrokes via polling. [9] |
| Redhip | 2011 | F0002.001 | Malware logs keystrokes via application hook. [9] |
| Redhip | 2011 | F0002.002 | Malware logs keystrokes via polling. [9] |
| Rombertik | 2015 | F0002.002 | Malware logs keystrokes via polling. [9] |
| Ursnif | 2016 | F0002.002 | Malware logs keystrokes via polling. [9] |
Detection
| Tool: capa | Mapping | APIs |
|---|---|---|
| log keystrokes via polling | Keylogging::Polling (F0002.002) | user32.GetAsyncKeyState, user32.GetKeyState, user32.GetKeyboardState, user32.VkKeyScan, user32.VkKeyScanEx, user32.GetKeyNameText |
| log keystrokes via application hook | Keylogging::Application Hook (F0002.001) | -- |
| Tool: CAPE | Mapping | APIs |
|---|---|---|
| infostealer_keylog | Keylogging (F0002) | SetWindowsHookExA, GetAsyncKeyState, SetWindowsHookExW |
| infostealer_keylog | Keylogging::Application Hook (F0002.001) | SetWindowsHookExA, GetAsyncKeyState, SetWindowsHookExW |
| browser_scanbox | Keylogging (F0002) | JsEval, COleScript_ParseScriptText, COleScript_Compile |
F0002.002 Snippet
Collection::Keylogging::Polling
SHA256: 000b535ab2a4fec86e2d8254f8ed65c6ebd37309ed68692c929f8f93a99233f6Location: 0x438af1
push 0x11 ; provide argument for function call. In this case, 0x11 is the Windows keyboard code for indicating the 'CTRL' key call USER32.DLL::GetKeyState ; call function to get the state of the control key test ax, 0x8000 ; test to see what the previous function returned. In this case, we are seeing if the return value's high-order bit is a 1, which would mean the ctrl key is pressed setnz al ; if the previous condition is not met (the zero flag is 1), a 1 is stored in byte al
References
[1] https://www.f-secure.com/v-descs/backdoor_w32_hupigon.shtml
[2] https://citizenlab.ca/2016/04/between-hong-kong-and-burma/
[3] https://securelist.com/be2-custom-plugins-router-abuse-and-target-profiles/67353/
[4] https://blog.malwarebytes.com/threat-analysis/2012/06/you-dirty-rat-part-1-darkcomet/
[5] https://www.cyber.nj.gov/threat-center/threat-profiles/trojan-variants/poison-ivy
[6] https://web.archive.org/web/20210307034415/https://www.fireeye.com/content/dam/fireeye-www/global/en/current-threats/pdfs/rpt-apt28.pdf
[7] capa v4.0, analyzed at MITRE on 10/12/2022
[8] https://www.mandiant.com/sites/default/files/2021-09/rpt-poison-ivy.pdf
[9] capa v4.0, analyzed at MITRE on 10/12/2022