exploiting-sql-injection-vulnerabilities
它能做什么
这个工具可以帮助你查找并利用网站中的 SQL 注入(SQL Injection)安全漏洞。它会检查恶意命令能否被插入表单字段,从而访问或修改数据库数据。使用时必须获得授权。
适用场景
- ✓在网站上线前测试其安全性时。
- ✓验证网站输入的信息是否得到正确保护时。
- ✓演示网站被入侵、数据被窃取的风险时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-sql-injection-vulnerabilities/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“检查这个网站的登录表单是否存在 SQL 注入漏洞。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会尝试在网站的不同位置(比如文本框和 URL)插入一些小型命令,观察数据库是否出现异常响应。如果有异常,就说明存在漏洞。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Exploiting SQL Injection Vulnerabilities
When to Use
- Testing web application input parameters for SQL injection vulnerabilities during an authorized penetration test
- Validating that parameterized queries and input sanitization are properly implemented across all database interactions
- Demonstrating the business impact of a confirmed SQL injection vulnerability by extracting sensitive data
- Verifying that WAF rules and input validation controls effectively block SQL injection payloads
- Testing stored procedures, dynamic SQL, and ORM bypass scenarios in enterprise applications
Do not use against databases without written authorization, for extracting or exfiltrating actual customer data beyond what is needed for proof of concept, or against production databases where exploitation could corrupt data integrity.
Prerequisites
- Written authorization specifying the target application and permissible level of exploitation (detection only vs. full exploitation)
- Burp Suite Professional configured as an intercepting proxy to capture and modify HTTP requests
- sqlmap installed with current version for automated detection and exploitation
- Knowledge of the target database engine (MySQL, PostgreSQL, MSSQL, Oracle) or ability to fingerprint it
- Test accounts at various privilege levels to test injection in authenticated contexts
Workflow
Step 1: Injection Point Discovery
Identify parameters that interact with the database:
- Map all input vectors: Catalog every parameter in URLs (GET), request bodies (POST), HTTP headers (Cookie, Referer, User-Agent, X-Forwarded-For), and JSON/XML API payloads
- Error-based detection: Inject a single quote (
') into each parameter and observe the response. SQL errors (e.g., "You have an error in your SQL syntax", "unterminated quoted string", "ORA-01756") confirm the parameter reaches the database unsanitized. - Boolean-based detection: Inject
' AND 1=1--(true condition) and' AND 1=2--(false condition). If the responses differ (different content length, different data returned, different HTTP status), the parameter is injectable. - Time-based detection: Inject
'; WAITFOR DELAY '0:0:5'--(MSSQL),' AND SLEEP(5)--(MySQL), or'; SELECT pg_sleep(5)--(PostgreSQL). A 5-second response delay confirms injection. - Out-of-band detection: Use payloads that trigger DNS or HTTP requests to a Burp Collaborator domain to confirm injection in scenarios where responses are not directly observable.
- Second-order injection: Test for injection where input is stored and later used in a different SQL query (e.g., username stored at registration, used in a query on the profile page).
Step 2: Database Fingerprinting
Determine the database engine and version to select appropriate exploitation techniques:
- Error-based fingerprinting: Each database produces distinctive error messages. MySQL includes "MySQL", MSSQL mentions "SQL Server", PostgreSQL references "PG", Oracle contains "ORA-".
- Function-based fingerprinting: Inject database-specific functions:
- MySQL:
' AND VERSION()--or' AND @@version-- - MSSQL:
' AND @@version--or' AND DB_NAME()-- - PostgreSQL:
' AND version()-- - Oracle:
' AND banner FROM v$version--
- MySQL:
- String concatenation differences: MySQL uses
CONCAT('a','b')or'a' 'b', MSSQL uses'a'+'b', PostgreSQL uses'a'||'b', Oracle uses'a'||'b' - Comment syntax: MySQL supports
#and--, MSSQL uses--, PostgreSQL uses--, Oracle uses--
Step 3: Manual Exploitation Techniques
Exploit confirmed injection points using technique-appropriate methods:
- UNION-based extraction: Determine the number of columns with
ORDER BYincrementing (' ORDER BY 1--,' ORDER BY 2--, etc. until an error occurs). Then construct UNION SELECT to extract data:' UNION SELECT NULL,username,password,NULL FROM users-- - Error-based extraction (MySQL): Use
EXTRACTVALUEorUPDATEXMLto force data into error messages:' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT @@version),0x7e))-- - Blind boolean extraction: Extract data one character at a time by testing character values:
' AND SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a'-- - Time-based blind extraction: Same character-by-character approach using time delays:
…
常见问题
什么是 SQL 注入?
这是一种攻击方式,攻击者在网站的输入字段中插入恶意命令。如果网站没有做好防护,这些命令就会在数据库中执行,从而让攻击者查看、修改或窃取信息。
使用这个工具需要许可吗?
需要。进行任何测试之前,都必须获得网站所有者的书面授权。未经许可使用属于违法行为。
这个工具会损坏网站吗?
如果使用不当或未经许可,确实可能造成损害。它是为受控的安全测试而设计的,未经明确授权,不应用于正式运行的网站,因为它可能会破坏数据。
详情
作者的原始描述
Identifies and exploits SQL injection vulnerabilities in web applications during authorized penetration tests using manual techniques and automated tools like sqlmap. The tester detects injection points through error-based, union-based, blind boolean, and time-based blind techniques across all major database engines (MySQL, PostgreSQL, MSSQL, Oracle) to demonstrate data extraction, authentication
热度
- GitHub 星标
- 35k
- 排名
- #7923
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。