buffer / thug

Python low-interaction honeyclient
GNU General Public License v2.0
983 stars 202 forks source link

Sample: `1b61b16dd4b7f6203d742b47411ca679f1f5734ed01534a37a126263f84396c0` #368

Closed cccs-kevin closed 8 months ago

cccs-kevin commented 8 months ago

Hi @buffer,

I'm ramping up the inclusion of the Thug tool in the Assemblyline project (specifically in the JsJaws service), but I'm noticing a lack of detection / payload extraction for samples such as the one mentioned. The de-obfuscated JavaScript as per the Synchrony project contains the following:

if (window.navigator.msSaveOrOpenBlob) {
    window.navigator.msSaveOrOpenBlob(blob, 'Document5934.zip');
} else {
    var url = URL.createObjectURL(blob), a = document.createElement('a');
    a.href = url;
    a.download = 'Document5934.zip';
    document.body.appendChild(a);
    a.click();
    setTimeout(function () {
        ;
        document.body.removeChild(a);
        window.URL.revokeObjectURL(url);
        ;
    }, 0);
    ;
}

When I run the sample in Thug using the osx10chrome97 useragent, I see that no file is added to the "files" key of the analysis.json and I suspect that this is due to lack of URL.createObjectURL/URL.revokeObjectURL in the context?

Let me know if I'm on the right track!

cccs-kevin commented 8 months ago

Another sample that depends on this functionality is 1e98af662c337468274d2a20e1f5eb66645c8fff55269ee09fa9ba6e0733ce98

From the logs: [MIMEHANDLER (SVG+XML)][ERROR] TypeError: URL.createObjectURL is not a function ( @ 30 : 41 ) -> let IV7XsVbK = URL["createObjectURL"](JkT5zYmW);

buffer commented 8 months ago

@cccs-kevin I confirm your analysis. Thug currently lacks the implementation of the URL methods createObjectURL and revokeObjectURL. I created just two placeholders at the moment but I think having at least a sample handy could be really beneficial in order to figure out how the methods are used. And I realized I can not download them from VirusTotal. Would you mind sharing them (even privately if you prefer)? Thanks!

cccs-kevin commented 8 months ago

Sure thing, here is the MalwareBazaar link:

https://bazaar.abuse.ch/sample/1b61b16dd4b7f6203d742b47411ca679f1f5734ed01534a37a126263f84396c0/

buffer commented 8 months ago

Thanks! Really appreciate!

buffer commented 8 months ago

FYI it seems like I fixed both this issue and the issue https://github.com/buffer/thug/issues/369. As you can see from the attached output, the (base64 encoded) encrypted ZIP file is now correctly stored in the JSON report. I am going to open a PR later today and perform some additional tests before merging. Please expect a new Thug release soon.

~ $ thug -u osx10chrome97 -l -F -Z 1b61b16dd4b7f6203d742b47411ca679f1f5734ed01534a37a126263f84396c0.html
[2024-01-30 12:11:34] [window open redirection] about:blank -> blob://about:blank/90113783-fa43-4aea-866a-43a0eedf1b7d
[2024-01-30 12:11:34] [MIMEHANDLER (ZIP)][ERROR] File 'doc/Valid445.lnk' is encrypted, password required for extraction
[2024-01-30 12:11:34] Thug analysis logs saved at /tmp/thug/logs/3f21298a46011be141bcc21e9179a706/20240130121134

~ $ jq '.files' < /tmp/thug/logs/3f21298a46011be141bcc21e9179a706/20240130121134/analysis/json/analysis.json
[
  {
    "type": "ZIP",
    "md5": "9782d065f715729a10ec754610bb3f91",
    "sha1": "4f8fb3d85523183cccd5570ae004357e86907858",
    "sha256": "05b8f8346baf3d7f50bc4315cd3d66e716916e716cc5ef3d3942dd7c2b71e933",
    "ssdeep": "24:DMh1C78O/ymafE1GKf7u5u+EL9dL0hTCLa4tC5:DqnpmkERwu+EL9dBu",
    "url": "about:blank",
    "data": "UEsDBAoAAAAAAKOIKFUAAAAAAAAAAAAAAAAEABwAZG9jL1VUCQADwSAaY8EgGmN1eAsAAQQAAAAABAAAAABQSwMEFAAJAAgAo4goVYG/icpmAwAAkQgAABAAHABkb2MvVmFsaWQ0NDUubG5rVVQJAAPBIBpjwSAaY3V4CwABBAAAAAAEAAAAACZV2FQRYSiqMiyXoZna/+rOqVDWPKv4YrvDOqAJnMK84hZxs2t/CZNFeC0MDjBCP/wkloB0nOs610ZU1hoQHf2MLip/yh6UsHOUFjtDlgrl3HrhD0m41YeiSSjZA/5i643ZkFTOWPwEp/T0bctDU2vSpYSVxbd0npebZsA6FMlA6cGSzrf2cVbz1Iyvb2RkCrmexgE7dhlXhkRCOGX5uZnaiQGbJaD40c5ij94kcxiUrIObN3Q+hEdVHKIQQ61pw+II7irLKHv1HbHzbfUw6CO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