This module exploits a Stack-based Buffer Overflow vulnerability in Ivanti Connect Secure to achieve remote code execution (CVE-2025-22457). Versions 22.7R2.5 and earlier are vulnerable. Note that Ivanti Pulse Connect Secure, Ivanti Policy Secure and ZTA gateways are also vulnerable but this module doesn't support this software. Heap spray is used to place our payload in memory at a predetermined location. Due to ASLR, the base address of `libdsplibs` is unknown. This library is used by the exploit to build a ROP chain and get command execution. As a result, the module will brute force this address starting from the address set by the `LIBDSPLIBS_ADDRESS` option.
Linux
cmd
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
msf > use exploit/linux/http/ivanti_connect_secure_stack_overflow_rce_cve_2025_22457
msf exploit(ivanti_connect_secure_stack_overflow_rce_cve_2025_22457) > show targets
...targets...
msf exploit(ivanti_connect_secure_stack_overflow_rce_cve_2025_22457) > set TARGET < target-id >
msf exploit(ivanti_connect_secure_stack_overflow_rce_cve_2025_22457) > show options
...show and set options...
msf exploit(ivanti_connect_secure_stack_overflow_rce_cve_2025_22457) > exploit
Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.
– Jim O’Gorman | President, Offensive Security