From 9268018a058c865d78299b6b2a46d596e2cc00ab Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 4 Jul 2022 22:38:15 +0200 Subject: [PATCH] Update 'Report.md' --- Report.md | 132 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 90 insertions(+), 42 deletions(-) diff --git a/Report.md b/Report.md index 8bd217b..3224e2d 100644 --- a/Report.md +++ b/Report.md @@ -1,73 +1,132 @@ # Spidey Malware +## Context +Spidey is a Malware-as-a-service type of virus, coded by an unknown hacker, maybe someone going by the nickname ``Epsilon``, due to its overuse in the source code ? (e.g `̀COOKIES FROM: ' + ⵂⵐⵊⵔ + ' #EPSILON`). This could however be totally unrelated. -* Payload: https://everlasting-swanky-comma.glitch.me/tiktoked.js -* Hook: https://discord.com/api/webhooks/984924488405753896/3jbjvpvICepQHbqeWzCaHeRg31j_lVgJAGZmjMk9HekCjcHcaCLaN2ItzOeuh4NBx6f- -* Client ID: +This virus is then sold to other threat actors, encoded and compacted in an ElectronJS app. At the time of deployment the ̀`.exe` is not detected on virus total. + +## Encounter +Encountered in the wild via a third party who got infected and tried to send me the link via message. The third party promptly realised something was afoot, tried to re-log upon having been disconnected and realised a 2FA had been set and they were now locked outside their account. Another third party then got infected in turn, and promptly got notified of a couple of payments for two Discord nitro gift cards and realised their discord had been compromised through similar means (This part is probably to setup a discord nitro scam but I never got to witness it). + +## Behaviour +During the whole process the attacker interacted via Discord messages with other victims through a simple social enginering attack. When caught and publicly outed on a server he then promptly tried to convince other victim he was the real owner of the account, and not in fact a hacker. + +This behaviour is very unlikely to be from a threat actor and most likely a sk trying to get some kicks out of the situation. However, interacting on a small community through a well known user, he was very promptly caught and kicked. + + +## Malware Info + +During the analysis of the virus, a couple of string caught my attention and are relevant to the per-instance deployment the threat. + +These informations are set at creation, and link to a discord bot and a server payload. This payload could not be retreived after the fact and therefore remains a mistery. +### Information stolen: + * All discord information + * All discord contact informations + * Discord token (allowing connection and impersonation) + * Computer Username + * Computer Hostname + * Public IP Address + * If existing: + * Exodus wallet as a zip + * APP_DATA + '\\FileZilla\\filezilla.xml' + * APP_DATA + '\\MobaXterm\\MobaXterm.xml' + * All Session in winscp2 + * All files in Downloads, Documents and Desktop containing `discord_backup_codes` + * If the account password is cracked: + * origin_url, username_value, password_value FROM logins + * host_key, name, encrypted_value FROM cookies + * card_number_encrypted,expiration_month,expiration_year,name_on_card FROM credit_cards + +### Data Persistence +* `path + '\\Local Extension Settings\\bfnaelmomeimhlpmgjnjophhpkkoljpa'+ '\\Phantom_' + discord_install_name + '.zip' ` +* `path + '\\Local Extension Settings\\nkbihfbeogaeaoehlefnkodbefgpgknn' + '\\Metamask_' + discord_install_name + '.zip'); ` + +### Information on the payload +* Payload: + * https://everlasting-swanky-comma.glitch.me/tiktoked.js + * A payload loaded at runtime. Could not be analysed. + +### Information gathered on the attacker +#### Client Info + * Client ID: * ID: 968179769235603526 + * The client id to report to. Presumably now inactive. * Created: Mon, 25 Apr 2022 16:00:44 UTC + +#### Bot +* Hook: + * https://discord.com/api/webhooks/984924488405753896/3jbjvpvICepQHbqeWzCaHeRg31j_lVgJAGZmjMk9HekCjcHcaCLaN2ItzOeuh4NBx6f- + * The webhook of the discord bot, still active at the time of writing this report. + * Bot: - * type 1 - * id "984924488405753896" - * name "Spidey Bot" - * avatar null - * channel_id "984923350478516284" - * Created: Fri, 10 Jun 2022 20:53:45 UTC - * guild_id "984923276302233611" - * Created: Fri, 10 Jun 2022 20:53:28 UTC - * application_id null - * token "3jbjvpvICepQHbqeWzCaHeRg31j_lVgJAGZmjMk9HekCjcHcaCLaN2ItzOeuh4NBx6f-" + * type: 1 + * id: "984924488405753896" + * name: "Spidey Bot" + * avatar: null + * application_id: null + * token: "3jbjvpvICepQHbqeWzCaHeRg31j_lVgJAGZmjMk9HekCjcHcaCLaN2ItzOeuh4NBx6f-" + +#### Server info +* channel_id: "984923350478516284" + * Server channel to connect the bot to. + * Created: Fri, 10 Jun 2022 20:53:45 UTC +* guild_id: "984923276302233611" + * Server to connect to. + * Created: Fri, 10 Jun 2022 20:53:28 UTC -# Security assesment -## Credentials Extra: +# Security assessment +## Credentials Extra Through the exploitation of various windows vulnerabilities and piss-poor security implementations, many other services are also targeted. - * winscp.net - * Mainly non encrypted config files +If the victim is using any of these four applications, the virus will find it and leverage it to gain full control over their computer. + +* winscp.net + * WinSCP is prone to a vulnerability that lets an attacker upload arbitrary files to a victim's computer or to download arbitrary files from the victim's computer in the context of the vulnerable application. + * Mainly non encrypted config files in `'HKCU\\SOFTWARE\\Martin Prikryl\\WinSCP 2\\Sessions'` * 2007-09-13 WinSCP 4.0.3 - URL Protocol Handler Arbitrary File Access * https://www.securityfocus.com/bid/25655/info - * WinSCP is prone to a vulnerability that lets an attacker upload arbitrary files to a victim's computer or to download arbitrary files from the victim's computer in the context of the vulnerable application. * MobaXterm + * Remote attackers can use UDP socket connection to TFTP server port 69 and send Read request, to retrieve otherwise protected files using directory traversal attacks e.g. ../../../../Windows/system.ini * MobaXterm Personal Edition 9.4 - Directory Traversal * http://hyp3rlinx.altervista.org/advisories/MOBAXTERM-TFTP-PATH-TRAVERSAL-REMOTE-FILE-ACCESS.txt * CVE-2017-6805 - * Remote attackers can use UDP socket connection to TFTP server port 69 and send Read request, to retrieve otherwise protected files using directory traversal attacks e.g. ../../../../Windows/system.ini * Filezilla - * 0/10: Credentials stored in an xml file - * https://www.exploit-db.com/exploits/37729 + * Credentials stored in an xml file (very bad practice) + * https://www.exploit-db.com/exploits/37729 (very scary looking exploit) * 2015-08-07 FileZilla Client 2.2.x - Remote Buffer Overflow (SEH) Remote Windows ly0n * 2015-06-15 FileZilla 3.11.0.2 SFTP Module - Denial of Service * \\Exodus\\exodus.wallet + * RCE means the threat actor has taken over the hosts computer. * RCE : 2018-03-29 Exodus Wallet (ElectronJS Framework) - Remote Code Execution (Metasploit) Metasploit * https://www.exploit-db.com/exploits/44357 ## WinDPAPI -The official windows credential manager is hit for every entry, looking for the following: +The official windows credential manager is scanned for every entry, looking for the following: * ``SELECT origin_url, username_value, password_value FROM logins`` * ``SELECT host_key, name, encrypted_value FROM cookies`` * ``SELECT card_number_encrypted,expiration_month,expiration_year,name_on_card FROM credit_cards`` -However unless the windows master key is exposed (through one of the above exploits), the only vector of decription is password reuse or a trivial enough password (This part is very likely in the payload : https://everlasting-swanky-comma.glitch.me/tiktoked.js or the encrypted m0Xe) +However unless the windows master key is exposed (through one of the above exploits), the only vector of exploitation is password reuse or a trivial enough password. +The actual password cracking is very likely in the payload : https://everlasting-swanky-comma.glitch.me/tiktoked.js or the encrypted m0Xe function. * Sources: - > https://en.wikipedia.org/wiki/Data_Protection_API - > https://github.com/abdulkadir-gungor/DPAPI/tree/main/Browser_Stealer - > https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords + * https://en.wikipedia.org/wiki/Data_Protection_API + * https://github.com/abdulkadir-gungor/DPAPI/tree/main/Browser_Stealer + * https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords ## Discord security ### Method of operation -Accesing a aes256-encripted token and leveraging it to gain full control of discord. -This vulnerability lets the attacker spread the virus to other victims. +Discord stores the user token in a aes256-encripted file, however the encription is pseudo-trivial and can be found in the config files (see next section). By decoding the token the virus gains full access to the discord account, letting the threat actor impersonate the victim, spreading further the malware. -All virus API is deeply tied to Discord bots, letting the virus user have a very modern and pleasant experience. +All virus API is deeply tied to Discord bots, letting the virus user have a very modern and pleasant experience. Receiving messages through a discord channel in a neat and tidy way. -Through the use of the Discord api the attacker is able to narrow down it's victims to avoid anyone connected with a moderator or a developper and focusing on nitro users (or any criteria of his choosing). +Through the use of the Discord api the attacker is able to narrow down its victims by name, discord server, number of friends, nitro abonnement and badges (embassador, hypesquad, early adopter, developper, staff etc...) to avoid anyone connected with a moderator or a developper and focusing on nitro users (or any criteria of his choosing). ### AES-256 Featuring Rick Astley The AES implementation of the token encryption is ... subpar. Leading to a trivial-ish decription and an near-instant exploitation. -* ``'dQw4w9WgXcQ:[^.*\\['(.*)'\\].*$][^\\"]*'`` +* The script is looking for this regex in the .log files ``'dQw4w9WgXcQ:[^.*\\['(.*)'\\].*$][^\\"]*'`` and using it to extract the aes256 key. Snipplet ```js @@ -93,14 +152,3 @@ The AES implementation of the token encryption is ... subpar. Leading to a trivi ### Other Ressources * https://github.com/LocalsGitHub/Decrypt-Discord-Token/blob/main/decrypt.py - - -### TODO -Investigate the buffer_replace: -```js -req_fs['writeFileSync'](ⵂⴰⵀⵖ, req_buffer_replace(ⵂⵀⴵⵖ, 'api/webhooks', 'vulsa1111')); -``` - - -### Final thoughts - > Discord, security is a job, not a fucking hobby.