qeeqbox/stored-cross-site-scripting

GitHub: qeeqbox/stored-cross-site-scripting

一个故意包含存储型 XSS 漏洞的 Web 应用,用于演示和学习恶意 payload 如何通过数据库持久化并在受害者浏览器中执行。

Stars: 5 | Forks: 3

一个应用程序允许用户控制文档对象模型 (DOM) 环境。威胁行为者可以通过将恶意 payload 注入到受信任的 Web 应用程序数据库中来利用此功能。当用户与数据库进行交互并请求资源时,他们的浏览器会检索该 payload 并执行它。此漏洞反映在 HTTP(s) 响应中并发生在客户端。然而,payload 保存在服务器端 递归克隆当前仓库 ``` git clone --recurse-submodules https://github.com/qeeqbox/stored-cross-site-scripting ``` 使用 Python 运行 webapp ``` python3 stored-cross-site-scripting/vulnerable-web-app/webapp.py ``` 在浏览器中打开 webapp 127.0.0.1:5142

Use the default credentials (username: admin and password: admin) to login

A threat actor could embed a malicious payload instead of a ticket

When the victim logs in (The admin user), the payload will be executed by the broswer

If you examine the ticket section, you will see the payload there

## 代码 当用户向 webapp 添加工单时,该工单会通过 POST 请求从用户发送到 webapp,此时会使用 add 路由,并将数据传递给 add_ticket() 函数 ``` def do_POST(self): ... elif parsed_url.path == "/add": self.add_ticket(post_request_data["ticket"][0]) self.redirect(URL) ... ``` add_ticket() 函数会将用户输入的值嵌入到 SQLite 数据库中 ``` @logged_in @check_access(access="ticket") def add_ticket(self, ticket): with connect(DATABASE, isolation_level=None) as connection: cursor = connection.cursor() cursor.execute("INSERT into ticket(username, ticket) values(?,?)", (self.session["username"], ticket)) return True return False ```
标签:Python, Web安全, XSS, 安全, 无后门, 漏洞情报, 漏洞环境, 蓝队分析, 超时处理, 逆向工具