This repository has been archived on 2024-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
Desobfuscating-Spidey/Report.md

8.7 KiB

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.

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

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

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 assessment

Credentials Extra

Through the exploitation of various windows vulnerabilities and piss-poor security implementations, many other services are also targeted. 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
  • MobaXterm
  • Filezilla
    • 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 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 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.

Discord security

Method of operation

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. 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 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.

  • The script is looking for this regex in the .log files 'dQw4w9WgXcQ:[^.*\\['(.*)'\\].*$][^\\"]*' and using it to extract the aes256 key.

Snipplet

(list_of_files['endsWith']('.log') || list_of_files['endsWith']('.ldb')) && req_fs['readFileSync'](base_path + '\\' + list_of_files, 'utf8')['split'](/\r?\n/)['forEach'](new_line => {
    const rickrolled = [new RegExp('dQw4w9WgXcQ:[^.*\\['(.*)'\\].*$][^\\"]*')];
    for (const rick of rickrolled) {
        const yes_rick = new_line['match'](rick);
        if (yes_rick) {
            yes_rick['forEach'](mini_rick => {
                let auth_tag = Buffer['from'](mini_rick['split']('dQw4w9WgXcQ:')[(1)], 'base64');
                let main_key = auth_tag['slice'](3, 15);
                let base_64_id = auth_tag['slice'](15, auth_tag['length'] - 1);
                let c_tag = auth_tag['slice'](auth_tag['length'] - 1, auth_tag['length']);
                let decypher_id = req_crypto['createDecipheriv']('aes-256-gcm', decrypt_method, main_key);
                decypher_id['setAuthTag'](c_tag);
                let decypher = decypher_id['update'](base_64_id, 'base64', 'utf-8') + decypher_id['final']('utf-8');
                result['push'](decypher);
            });
        }
    }
});

Other Ressources