Authorized blackbox web security

From Dirtytrii/codex-skills · View interactive version

Authorized blackbox web security is an AI agent skill from the GitHub repository Dirtytrii/codex-skills. Run user-authorized black-box web security tests and evidence-based reports. Use for 黑盒安全测试、渗透测试、数据泄露、未授权访问、公开 JS/API、登录爆破防护、CORS 或安全响应头检查。

How to use this skill

Skill file

Authorized Black-Box Web Security

Purpose

Use this skill to run a careful, user-authorized black-box security assessment from a public URL and produce a practical report. The default goal is to prove realistic data exposure or unauthorized modification risk without noisy traffic, broad enumeration, or harm to existing customer records.

This is for defensive work on assets the user owns or is authorized to test.

Safety Boundary

Before testing, confirm the request is framed as authorized. If ownership or authorization is ambiguous, ask for confirmation before sending security probes.

Never perform:

Allowed by default when authorized:

If the user explicitly allows destructive writes, still prefer a single uniquely named probe record and mutate only that probe. Revert it when the API allows and record the probe ID for cleanup.

First Move

If a target URL and authorization are already clear, start testing immediately. If not, ask only for the missing minimum:

请确认目标 URL、你是否授权测试,以及是否允许创建一个唯一标记的测试记录。

When the user specifies a black-box scope, do not use local repository code as report evidence. Local code may be used later only if the user asks for remediation or white-box follow-up.

Evidence Workspace

Create a timestamped temp directory:

OUT="/tmp/blackbox-web-security-$(date -u +%Y%m%dT%H%M%SZ)"
mkdir -p "$OUT/assets" "$OUT/evidence"

Save response headers, bodies, extracted asset lists, and summarized JSON there. Avoid placing raw sensitive data in the final report.

Use safe variable names in zsh. Do not assign to path, because it can clobber command lookup.

Recon Workflow

Start from the public entry URL only:

  1. Fetch the HTML and response headers.
  2. Extract script, CSS, modulepreload, and asset URLs.
  3. Download business JS chunks with low concurrency or sequential curl.
  4. Search public assets for:
  1. Check common direct exposures at low volume:
  1. Check DNS/subdomain clues only lightly. Do not brute-force subdomains.

Useful commands:

curl -sS -D "$OUT/evidence/landing.headers" -o "$OUT/landing.html" "$TARGET"
rg -n "https?://|/api/|token|Authorization|X-.*Token|swagger|h2-console" "$OUT/assets" -S

Validation Workflow

Authentication And Authorization

For each sensitive endpoint discovered:

Prefer summaries like:

{"endpoint":"/api/admin/teachers","http_code":200,"code":"0","data_type":"array","count":1,"sample_keys":["id","username","status"]}

Controlled Write Proof

Use this only when there is a safe public create path or the user explicitly allowed destructive testing.

Recommended path:

  1. Create exactly one probe record through a public submit endpoint.
  2. Include a unique marker such as codex-security-probe-<timestamp>.
  3. Read only that probe through the suspected unauthorized admin path.
  4. Change one harmless status field once, then revert.
  5. Record probe ID, final state, and cleanup instructions.

If the create/list path fails, do not keep retrying. Report the failure and use a non-mutating write reachability check instead, such as:

If exposed token returns validation/business errors while no-auth returns unauthorized, that proves the request passed authorization without modifying data.

Login Protection

Use nonexistent usernames only.

Default cap:

Do not use real accounts or guess passwords.

CORS And Headers

Check:

Also check:

Remember: CORS is not authentication. Curl/Postman/server-side attackers can still use leaked tokens even if browsers cannot read cross-origin responses.

Role Boundary Checks

For teacher, parent, user, or legacy APIs:

Severity Defaults

Calibrate severity by actual impact and whether the PoC reaches data or write paths.

Report Format

Create a report file when working inside a repo, usually:

docs/security/<project>-blackbox-security-report-<yyyy-mm-dd>.md

Use the user's language. Default structure:

# <Project> 黑盒安全测试报告

测试时间:
入口范围:
测试方式:
流量边界:
证据目录:

## 执行摘要
## 攻击路径
## 发现 1:...
### 证据
### 影响
### 修复建议
## 受控写入验证结果
## 其他非发现项
## 优先修复清单
## 复测标准

Include exact PoC commands but redact sensitive output. Do not paste full datasets. Show enough to prove impact:

Always include non-findings so future testers do not repeat the same checks.

Final Response

Keep the closeout concise:

Do not claim destructive proof if only validation-error reachability was confirmed.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.