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

Add module for Citrix Bleed (CVE-2023-4966) #18492

Merged
merged 4 commits into from Oct 30, 2023

Conversation

zeroSteiner
Copy link
Contributor

@zeroSteiner zeroSteiner commented Oct 26, 2023

This adds a module for exploiting CVE-2023-4966 which is a memory leak in Citrix ADC servers that can be used to leak session cookies of authenticated users.

A user needs to be logged in for the vulnerability to be usable to leak a session cookie. While testing my 13.1-48.47 target, with multiple users authenticated it appears that the session cookie that is leaked is consistently the last user that authenticated and not the session cookie of the last request that was received. For that reason, it doesn't make a lot of sense to make multiple attempts to leak cookies in a short time frame as I was originally considering (say 1 request per second over 10 seconds). If the observations are correct, this would only be beneficial and leak multiple cookies if users were login within that time period.

Example Output

msf6 auxiliary(scanner/http/citrix_bleed_cve_2023_4966) > show options 

Module options (auxiliary/scanner/http/citrix_bleed_cve_2023_4966):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS     192.168.159.150  yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT      443              yes       The target port (TCP)
   SSL        true             no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                yes       Base path
   THREADS    20               yes       The number of concurrent threads (max one per host)
   VHOST                       no        HTTP server virtual host


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

msf6 auxiliary(scanner/http/citrix_bleed_cve_2023_4966) > rerun VERBOSE=true
[*] Reloading module...

[*] Checking cookie: b6e7bf2ef97ef32da90e62f5e4be00b00c3a0818745525d5f4f58455e445a4a42
[+] Cookie: NSC_AAAC=b6e7bf2ef97ef32da90e62f5e4be00b00c3a0818745525d5f4f58455e445a4a42 username: metasploit
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/http/citrix_bleed_cve_2023_4966) >

Closes #18486

@zeroSteiner zeroSteiner marked this pull request as ready for review October 26, 2023 13:54
@smcintyre-r7 smcintyre-r7 added module docs rn-modules release notes for new or majorly enhanced modules labels Oct 26, 2023
@cdelafuente-r7 cdelafuente-r7 self-assigned this Oct 26, 2023
return nil unless res.headers['Content-Type'].downcase.start_with?('application/json')

username = nil
res.body.scan(/([0-9a-f]{32,65})/i).each do |cookie|
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
res.body.scan(/([0-9a-f]{32,65})/i).each do |cookie|
res.body.scan(/([0-9a-f]{65}|[0-9a-f]{32})/i).each do |cookie|

{32,65} means "between 32 and 65 in length". Note that the order is important in my suggestion, since the regex will try to match the first condition (length = 65), and then "length = 32", so that truncation shouldn't happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean to keep it at "between 32 and 65 in length". That was intentional because there were implications that different versions used different sized cookies but I wasn't clear that it's always either exactly 32 or 65 bytes in length. Ultimately, the cookie's value is tested anyways, so it's unlikely we'd yield false positives. This would just reduce the set that are tested.

Log servers that are vulnerable but don't leak any cookies
@cdelafuente-r7
Copy link
Contributor

Thanks @zeroSteiner for updating this. Everything looks good to me, this has been tested against live targets and confirmed the user Cookies were retrieved. I'll go ahead and land it.

@cdelafuente-r7 cdelafuente-r7 merged commit ec3cf74 into rapid7:master Oct 30, 2023
34 checks passed
@cdelafuente-r7
Copy link
Contributor

Release Notes

This adds a scanner module for exploiting CVE-2023-4966 which is a memory leak in Citrix ADC servers. This vulnerability allows a remote, unauthenticated attacker to leak memory by sending a very large HTTP Host header. The leaked memory is then scanned for session cookies which can be hijacked if found.

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
Archived in project
Development

Successfully merging this pull request may close these issues.

CVE-2023-4966 --- Citrix Bleed: authentication bypass
5 participants