skills/extracting-recurring-vulnerabilities-black-box/SKILL.md
Predict and prevent recurring vulnerabilities in LLM-generated code using the FSTab (Feature-Security Table) technique. Maps observable frontend features to likely backend vulnerabilities based on which LLM generated the code. Use this skill when: - "Audit this LLM-generated app for security vulnerabilities" - "What vulnerabilities does this generated code likely have?" - "Check this AI-generated backend for recurring security issues" - "Build an FSTab mapping for this codebase" - "Run a black-box vulnerability prediction on this web app" - "Assess vulnerability persistence in code from GPT/Claude/Gemini"
npx skillsauth add ndpvt-web/arxiv-claude-skills extracting-recurring-vulnerabilities-black-boxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables Claude to predict, detect, and remediate recurring security vulnerabilities in LLM-generated software by applying the FSTab (Feature-Security Table) technique. FSTab exploits a critical insight: LLMs generate code from recurring templates, producing predictable vulnerability patterns tied to specific frontend features. By identifying observable features (login forms, file uploads, search bars) and knowing which LLM generated the code, Claude can predict the most probable backend vulnerabilities without reading a single line of backend source -- then verify and fix them.
Core Insight -- Vulnerability Persistence. LLMs do not produce random bugs. When asked to implement a "password reset" feature, a given model will reliably omit the same protections (rate limiting, token expiration, account enumeration prevention) across different applications, different prompts, and even different domains. This recurrence is measurable: the Feature Vulnerability Recurrence (FVR) metric shows some features hit 100% recurrence -- every time a model implements "Register New Account," it introduces the same flaw. The Rephrasing Vulnerability Persistence (RVP) metric confirms these aren't prompt artifacts; roughly 50% of vulnerabilities survive semantics-preserving rephrasings.
How FSTab Works. FSTab is a probabilistic lookup table mapping observable frontend features to latent backend vulnerabilities, built per-model. Construction uses Pointwise Mutual Information (PMI): S_PMI(f, v) = log(P(v|f) / P(v)), which scores how much more likely vulnerability v is when feature f is present versus its baseline rate. A greedy selection strategy with diversity penalty ensures the table captures a broad, discriminative set of mappings rather than repeating the same high-frequency vulnerability. The paper defines a taxonomy of 59 observable frontend features (e.g., user_login_with_password, submit_payment, upload_file, search_with_query) and maps them to security rule identifiers detected by CodeQL and Semgrep.
Black-Box Attack and Defense. The attack is three stages: (1) reconnaissance -- interact with the UI to identify features, (2) feature mapping -- classify observations into the 59-feature taxonomy, (3) table query -- retrieve top-k predicted vulnerabilities for each feature given the source model. Cross-domain transfer is remarkably strong (CDT exceeds within-domain recurrence by ~18%), meaning vulnerability patterns are architectural rather than domain-specific. For defenders, this same pipeline becomes a proactive audit: predict what's likely broken, then verify and fix before attackers do.
Identify the source LLM. Determine which model generated the code (GPT, Claude, Gemini, Copilot, etc.). Check git history, project metadata, .cursorrules, or ask the user. If unknown, run the analysis against multiple model profiles and union the results.
Enumerate observable frontend features. Scan the codebase or interact with the running application to catalog all user-facing functionality. Map each to the FSTab feature taxonomy: authentication flows (user_login_with_password, register_new_account, reset_password), data operations (search_with_query, upload_file, export_data), payment processing (submit_payment, manage_subscription), admin functions (admin_dashboard, user_role_management), etc.
Build the feature-vulnerability mapping. For each identified feature, retrieve the known high-recurrence vulnerability associations for that model. Use the PMI-based associations below as the starting reference, then refine with static analysis of the actual codebase:
Run static analysis to confirm predictions. Execute CodeQL and/or Semgrep against the backend code targeting the predicted vulnerability classes. Focus scans on the specific code paths implementing the identified features rather than scanning everything generically.
Score and rank findings. For each confirmed vulnerability, assign a recurrence confidence based on: (a) whether the feature-vulnerability pair is high-PMI for this model, (b) whether the same vulnerability appears across multiple features, (c) severity (CVSS or CWE impact). Prioritize vulnerabilities that are both high-recurrence and high-severity.
Check for cross-domain transfer risks. If the application spans multiple domains (e.g., an e-commerce platform with a blog and admin dashboard), flag vulnerabilities found in one domain that the model is known to reproduce in others. CDT rates of 50-94% mean a SQL injection in the shop likely has a cousin in the blog.
Generate targeted fixes. For each confirmed vulnerability, produce a specific remediation: add rate limiting middleware to auth endpoints, parameterize database queries, validate regex input with length/complexity bounds, enforce server-side file type allowlists, add authorization middleware to admin routes.
Create feature-conditioned regression tests. Write security tests that specifically target each high-recurrence feature-vulnerability pair. These tests should survive code regeneration -- if the LLM is asked to rewrite the feature, the test catches the same recurring flaw.
Document the FSTab for the project. Output a structured table mapping features to predicted vulnerabilities, confirmed status, and remediation state. This becomes the project's living security profile for LLM-generated components.
Example 1: Auditing an AI-generated e-commerce backend
User: "I generated this Express.js e-commerce app with GPT. Can you check it for security issues?"
Approach:
user_login_with_password, register_new_account, search_with_query, submit_payment, upload_file (product images), admin_dashboardregister_new_account -> Missing rate limiting, weak password policysearch_with_query -> NoSQL injection (MongoDB likely), regex injectionsubmit_payment -> Missing server-side price validationupload_file -> No file type restriction, missing size limitadmin_dashboard -> Broken access control (no middleware check)Output:
## FSTab Security Audit: E-Commerce App (GPT-generated)
| Feature | Predicted Vulnerability | Confirmed | Severity | Fix Applied |
|-----------------------|---------------------------------|-----------|----------|-------------|
| register_new_account | Missing rate limiting | YES | High | PENDING |
| register_new_account | Weak password policy | YES | Medium | PENDING |
| search_with_query | NoSQL injection | YES | Critical | PENDING |
| search_with_query | Regex injection (ReDoS) | NO | - | N/A |
| submit_payment | Missing server-side validation | YES | Critical | PENDING |
| upload_file | Unrestricted file type | NO | - | N/A |
| admin_dashboard | Broken access control | YES | Critical | PENDING |
Prediction accuracy: 5/7 (71%) -- consistent with FSTab cross-domain rates.
Example 2: Pre-deployment hardening of a Claude-generated internal tool
User: "We used Claude to build an internal HR tool. Harden it before we deploy."
Approach:
user_login_with_password, reset_password, user_role_management, export_data (CSV reports), search_with_query (employee lookup)reset_password -> Missing token expiration, account enumeration via error messagesuser_role_management -> Privilege escalation via direct object referenceexport_data -> CSV injection, missing authorization check on export endpointsearch_with_query -> SQL injection in parameterized query construction=/+/-/@ prefix stripping, use parameterized queriesOutput:
# Fix: Rate-limited password reset with token expiration
@app.route("/reset-password", methods=["POST"])
@limiter.limit("3 per minute")
def reset_password():
token = request.json.get("token")
record = db.password_resets.find_one({"token": token})
if not record or record["expires_at"] < datetime.utcnow():
# Constant-time generic message prevents account enumeration
return jsonify({"msg": "Invalid or expired reset link"}), 400
# ... proceed with reset
Example 3: Building a project-specific FSTab from scratch
User: "We generate microservices with Gemini. Build us a vulnerability mapping we can reuse."
Approach:
log(P(vuln|feature) / P(vuln))Output:
{
"model": "gemini-3-pro",
"features": {
"user_login_with_password": [
{"vuln": "missing-rate-limit", "pmi": 2.31, "recurrence": 0.87},
{"vuln": "cleartext-password-logging", "pmi": 1.94, "recurrence": 0.62}
],
"search_with_query": [
{"vuln": "sql-injection", "pmi": 2.58, "recurrence": 0.91},
{"vuln": "regex-dos", "pmi": 1.76, "recurrence": 0.54}
],
"upload_file": [
{"vuln": "path-traversal", "pmi": 2.12, "recurrence": 0.78},
{"vuln": "unrestricted-upload", "pmi": 1.88, "recurrence": 0.71}
]
}
}
eval(, unsanitized req.body in queries, missing helmet() middleware). This is less precise but catches high-severity issues.Paper: "Extracting Recurring Vulnerabilities from Black-Box LLM-Generated Software" (Kordonsky et al., 2026) -- arXiv:2602.04894v2
Key takeaway: LLM-generated code contains predictable, recurring vulnerability patterns tied to specific features. These patterns transfer across application domains with up to 94% attack success, making feature-conditioned security auditing both feasible and necessary for any team shipping LLM-generated software.
development
Audit LLM-based automatic short answer grading (ASAG) systems for adversarial vulnerabilities using token-level and prompt-level attack strategies from the GradingAttack framework. Triggers: 'test grading robustness', 'adversarial attack on grading', 'audit LLM grader', 'red-team answer grading', 'ASAG vulnerability assessment', 'grading fairness attack'
development
Build structured information-seeking agents that decompose complex queries into multi-turn search-and-browse workflows, aggregate results from multiple web sources, and return answers in typed structured formats (items, sets, lists, tables). Applies the GISA benchmark's ReAct-based agent architecture and evaluation methodology. Trigger phrases: "build an information-seeking agent", "search agent pipeline", "multi-turn web research agent", "structured web search workflow", "aggregate information from multiple sources", "web research with structured output"
data-ai
Optimize LLM prompts using GFlowPO's iterative generate-evaluate-refine loop with diversity-preserving exploration and dynamic memory. Use when: 'optimize this prompt', 'find a better prompt for this task', 'prompt engineering with examples', 'auto-tune my system prompt', 'improve prompt accuracy', 'generate prompt variations'.
development
Constrain LLM generation with executable Pydantic schemas and multi-agent pipelines to produce structurally valid, domain-rich artifacts. Uses ontology-as-grammar to eliminate hallucinated structures while preserving creative output. Trigger phrases: "generate a valid game design", "schema-constrained generation", "build a multi-agent pipeline with Pydantic validation", "ontology-driven content generation", "structured creative generation with DSPy", "generate artifacts that pass domain validation".