From e921fbdf19b1958a7849c2b4eb0bff025a2dada9 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Wed, 7 Aug 2019 21:21:14 +0200 Subject: [PATCH] update SolarWinds Orion patch (3) --- OpenCL/m21500-pure.cl | 4 ++-- docs/readme.txt | 1 - src/Makefile | 2 +- src/modules/module_21500.c | 45 +++++++------------------------------- 4 files changed, 11 insertions(+), 41 deletions(-) diff --git a/OpenCL/m21500-pure.cl b/OpenCL/m21500-pure.cl index 0a8cad2f4..5864d8a61 100644 --- a/OpenCL/m21500-pure.cl +++ b/OpenCL/m21500-pure.cl @@ -30,7 +30,7 @@ typedef struct pbkdf2_sha1_tmp typedef struct pbkdf2_sha1 { - u32 salt_buf[5]; + u32 salt_buf[64]; } pbkdf2_sha1_t; @@ -243,7 +243,7 @@ KERNEL_FQ void m21500_comp (KERN_ATTR_TMPS_ESALT (pbkdf2_sha1_tmp_t, pbkdf2_sha1 sha512_init (&ctx); - sha512_update (&ctx, (const u32 *)tmps[gid].out, 1024); + sha512_update_global (&ctx, tmps[gid].out, 1024); sha512_final (&ctx); diff --git a/docs/readme.txt b/docs/readme.txt index 442dab752..7e3e8d468 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -279,7 +279,6 @@ NVIDIA GPUs require "NVIDIA Driver" (418.56 or later) and "CUDA Toolkit" (10.1 o - Ethereum Wallet, SCRYPT - Ethereum Pre-Sale Wallet, PBKDF2-HMAC-SHA256 - Ansible Vault -- SolarWinds Orion, SHA512(PBKDF2-HMAC-SHA1) - Plaintext ## diff --git a/src/Makefile b/src/Makefile index a0fc8e842..c61078a4a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,7 +4,7 @@ ## SHARED := 0 -DEBUG := 1 +DEBUG := 0 PRODUCTION := 0 PRODUCTION_VERSION := v5.1.0 ENABLE_BRAIN := 1 diff --git a/src/modules/module_21500.c b/src/modules/module_21500.c index 4afb4d687..53d4fd46b 100644 --- a/src/modules/module_21500.c +++ b/src/modules/module_21500.c @@ -58,7 +58,7 @@ typedef struct pbkdf2_sha1_tmp typedef struct pbkdf2_sha1 { - u32 salt_buf[5]; + u32 salt_buf[64]; } pbkdf2_sha1_t; @@ -140,7 +140,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE // salt - const u8 *salt_pos = token.buf[1]; + const char *salt_pos = (char *) token.buf[1]; int salt_len = token.len[1]; @@ -148,14 +148,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE memset (custom_salt, 0, sizeof (custom_salt)); - for (int i = 0; i < salt_len; i++, salt_pos++) - { - if (*salt_pos >= 'A' && *salt_pos <= 'Z') { - custom_salt[i] = *salt_pos + 32; - } else { - custom_salt[i] = *salt_pos; - } - } + strncpy (custom_salt, salt_pos, salt_len); + + lowercase ((u8 *) custom_salt, salt_len); if (salt_len < 8) { @@ -163,7 +158,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE salt_len = 8; } - memcpy (pbkdf2_sha1->salt_buf, custom_salt, salt_len); + memcpy ((char *) pbkdf2_sha1->salt_buf, custom_salt, salt_len); + memcpy (salt->salt_buf, custom_salt, salt_len); salt->salt_len = salt_len; @@ -196,32 +192,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { - const u64 *digest = (u64 *) digest_buf; - - const pbkdf2_sha1_t *pbkdf2_sha1 = (const pbkdf2_sha1_t *) esalt_buf; - - // hash - - u64 tmp[9]; - - tmp[0] = byte_swap_64 (digest[0]); - tmp[1] = byte_swap_64 (digest[1]); - tmp[2] = byte_swap_64 (digest[2]); - tmp[3] = byte_swap_64 (digest[3]); - tmp[4] = byte_swap_64 (digest[4]); - tmp[5] = byte_swap_64 (digest[5]); - tmp[6] = byte_swap_64 (digest[6]); - tmp[7] = byte_swap_64 (digest[7]); - tmp[8] = 0; - - char hash_enc[256] = { 0 }; - - base64_encode (int_to_base64, (const u8 *) tmp, 64, (u8 *) hash_enc); - - // output - const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_SOLARWINDS_ORION, (const u8 *) pbkdf2_sha1->salt_buf, hash_enc); - - return line_len; + return snprintf (line_buf, line_size, "%s", hash_info->orighash); } void module_init (module_ctx_t *module_ctx)