Chuyển đến nội dung
Skillpedia
Agent35k · #7923

exploiting-sql-injection-vulnerabilities

Skill này làm gì

Công cụ này giúp tìm và khai thác các lỗi bảo mật gọi là “SQL Injection” trên website. Nó kiểm tra xem có thể chèn lệnh độc hại vào ô nhập liệu để truy cập hoặc thay đổi dữ liệu cơ sở dữ liệu hay không, luôn có sự cho phép.

Khi nào nên dùng

  • ✓Để kiểm thử bảo mật website trước khi đưa vào hoạt động.
  • ✓Để xác minh thông tin nhập vào website có được bảo vệ đúng cách không.
  • ✓Để chứng minh rủi ro website bị tấn công và dữ liệu bị đánh cắp.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-sql-injection-vulnerabilities/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-sql-injection-vulnerabilities/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Kiểm tra xem form đăng nhập trên website này có dễ bị SQL Injection không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ thử chèn các lệnh nhỏ vào nhiều phần khác nhau của website (như ô nhập văn bản và URL) để xem cơ sở dữ liệu có phản hồi bất thường không. Nếu có, điều đó cho thấy có lỗ hổng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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--
  • 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 BY incrementing (' 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 EXTRACTVALUE or UPDATEXML to 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:
    
    

…

Câu hỏi thường gặp

SQL Injection là gì?

Đó là kiểu tấn công trong đó kẻ tấn công chèn lệnh độc hại vào ô nhập liệu của website. Nếu website không được bảo vệ, các lệnh này có thể chạy trên cơ sở dữ liệu, cho phép kẻ tấn công xem, sửa đổi hoặc đánh cắp thông tin.

Tôi có cần được phép để dùng công cụ này không?

Có, văn bản cho phép từ chủ website là điều bắt buộc trước khi kiểm thử. Dùng khi không được phép là bất hợp pháp.

Công cụ này có thể gây hại cho website không?

Nếu dùng sai hoặc không được phép, có. Công cụ được thiết kế cho kiểm thử bảo mật có kiểm soát và không nên dùng trên website đang hoạt động nếu không có sự cho phép rõ ràng, vì nó có thể làm hỏng dữ liệu.

Chi tiết

Mô tả gốc của tác giả

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

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#7923
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự