Soaperloafidksum's picture
Add FBE (Find-the-Bug Eval, 14 planted-vuln snippets, deterministic concept grading) as the primary benchmark; document VAB's forced-choice limitation
5e5152c verified
Raw
History Blame Contribute Delete
9.69 kB
{"id": "authz_alt_path", "vuln": "email route lacks the ownership check the read route has", "domain": "access_control", "code": "def get_invoice(user, invoice_id):\n inv = db.get_invoice(invoice_id)\n if inv.owner_id != user.id:\n raise Forbidden()\n return inv\n\ndef email_invoice(user, invoice_id, destination):\n inv = db.get_invoice(invoice_id)\n mailer.send(destination, inv.contents)", "must_hit": [["email"], ["owner", "ownership", "authoriz", "permission", "access control", "tenant"], ["missing", "no ", "not ", "lacks", "without", "fails", "absent", "never"]], "capability": [["another user", "other user", "any invoice", "not own", "does not own", "arbitrary", "other tenant", "someone else"]], "fix": [["check", "verify", "validate", "enforce", "policy", "scope", "same"]], "distractors": [["index", "performance", "efficien", "slow query"]]}
{"id": "mass_assign_role", "vuln": "role assigned from client-controlled payload (privilege escalation)", "domain": "access_control", "code": "def update_profile(request, current_user):\n payload = request.json\n current_user.display_name = payload[\"display_name\"]\n current_user.role = payload[\"role\"]\n db.save(current_user)", "must_hit": [["role"], ["privileg", "escalat", "admin", "authority", "elevat", "mass assign", "mass-assign"]], "capability": [["any role", "become admin", "administrator", "elevate", "escalate", "grant themselves", "set themselves"]], "fix": [["allowlist", "whitelist", "separate", "remove", "do not", "should not", "only admin", "exclude", "never"]], "distractors": [["sql", "injection", "xss"]]}
{"id": "second_order_ssrf", "vuln": "stored user URL later fetched server-side (SSRF)", "domain": "web_security", "code": "def set_webhook(user, url):\n user.webhook_url = url\n db.save(user)\n\ndef notify(user, event):\n http.post(user.webhook_url, json=event)", "must_hit": [["ssrf", "server-side request", "server side request", "internal", "metadata", "loopback", "localhost", "private", "arbitrary url", "attacker-controlled url", "attacker controlled url", "outbound request", "unvalidated url", "url is fetched"]], "capability": [["internal", "metadata", "169.254", "private network", "scan", "reach"]], "fix": [["allowlist", "whitelist", "validate", "scheme", "block", "deny", "restrict"]], "distractors": [["xss", "sql"]]}
{"id": "traversal_after_decode", "vuln": "validation runs before decoding, so traversal appears after (path traversal)", "domain": "web_security", "code": "def save_file(filename, data):\n if \"..\" in filename:\n raise ValueError(\"invalid\")\n decoded = unquote(filename)\n path = UPLOAD_DIR / decoded\n path.write_bytes(data)", "must_hit": [["traversal", "..", "directory", "escape", "outside"]], "capability": [["arbitrary", "overwrite", "outside", "escape", "any file", "system file"]], "fix": [["canonical", "resolve", "realpath", "after decod", "normaliz", "confine", "validate the decoded"]], "distractors": [["performance"]]}
{"id": "edit_after_approval", "vuln": "amount mutable after approval; execution trusts stale status", "domain": "general", "code": "def approve(p): p.status = \"approved\"; save(p)\ndef edit(p, amount): p.amount = amount; save(p)\ndef execute(p):\n if p.status == \"approved\":\n provider.transfer(p.amount)", "must_hit": [["after approv", "approved amount", "changed after", "edit", "mutat", "snapshot", "immutab"], ["amount"]], "capability": [["arbitrary amount", "larger", "any amount", "more than", "increase", "different amount"]], "fix": [["freeze", "immutab", "snapshot", "invalidate", "re-approv", "reauthor", "version"]], "distractors": [["sql", "xss"]]}
{"id": "token_not_consumed", "vuln": "reset token never marked used (reusable)", "domain": "access_control", "code": "def reset_password(token_value, new_password):\n token = db.get_reset_token(token_value)\n if token.expires_at < now():\n raise InvalidToken()\n user = db.get_user(token.user_id)\n user.password_hash = hash_password(new_password)\n save(user)", "must_hit": [["reus", "once", "single use", "single-use", "consum", "invalidat", "not marked", "remains valid", "multiple times", "again", "double-use", "double use", "twice", "re-use", "reused", "not consumed", "double use of token"]], "capability": [["again", "repeatedly", "multiple", "takeover", "reset again", "future"]], "fix": [["consume", "mark", "invalidat", "delete", "single use", "single-use", "transaction"]], "distractors": [["xss"]]}
{"id": "toctou_stock", "vuln": "check-then-act on stock is not atomic (race / oversell)", "domain": "general", "code": "def purchase(product_id, customer):\n p = db.get_product(product_id)\n if p.stock <= 0:\n raise OutOfStock()\n charge(customer, p.price)\n p.stock -= 1\n db.save(p)", "must_hit": [["race", "concurren", "atomic", "toctou", "simultaneous", "time-of-check", "time of check"]], "capability": [["oversell", "oversold", "negative", "two", "double", "more than", "twice"]], "fix": [["atomic", "lock", "transaction", "constraint", "compare-and-swap", "conditional update", "where stock"]], "distractors": [["xss", "injection"]]}
{"id": "client_identity_header", "vuln": "identity taken from a client-suppliable header", "domain": "access_control", "code": "def current_user(request):\n user_id = request.headers[\"X-User-ID\"]\n return db.get_user(user_id)", "must_hit": [["header"], ["forge", "spoof", "supply", "client", "arbitrary", "trust", "impersonat", "tamper"]], "capability": [["any user", "impersonat", "other user", "admin", "act as"]], "fix": [["gateway", "strip", "sign", "verify", "session", "token", "authenticat", "not trust", "should not"]], "distractors": [["performance"]]}
{"id": "worker_trusts_queue", "vuln": "worker trusts mutable amount/id from the queue message", "domain": "general", "code": "def process_refund(message):\n provider.refund(payment_id=message[\"payment_id\"],\n amount=Decimal(message[\"amount\"]))", "must_hit": [["trust", "authoritative", "message", "queue", "validat", "verify"], ["amount", "payment_id", "state"]], "capability": [["arbitrary", "tamper", "replay", "inject", "forge", "duplicate", "any amount"]], "fix": [["load", "authoritative", "database", "verify", "validate", "operation id", "idempot", "re-check", "recheck"]], "distractors": [["xss"]]}
{"id": "negative_amount", "vuln": "only balance>=amount checked; negative amount inverts the transfer", "domain": "general", "code": "def transfer(source, recipient, amount):\n if source.balance < amount:\n raise ValueError(\"insufficient funds\")\n source.balance -= amount\n recipient.balance += amount", "must_hit": [["negative", "less than zero", "below zero", "non-positive", "must be positive", "not positive", "positive"], ["amount"]], "capability": [["increase", "gain", "steal", "drain", "inflate", "own balance", "victim"]], "fix": [["positive", "greater than zero", "> 0", ">0", "amount <= 0", "validate"]], "distractors": [["sql", "xss"]]}
{"id": "fail_open_authz", "vuln": "authorization fails open on timeout", "domain": "access_control", "code": "def may_access(user, resource):\n try:\n return authz_service.check(user.id, resource.id)\n except TimeoutError:\n return True", "must_hit": [["fail open", "fail-open", "returns true", "grant", "allow", "open"]], "capability": [["unauthorized", "any user", "bypass", "all access", "everyone"]], "fix": [["fail closed", "fail-closed", "deny", "false", "cache", "degrade"]], "distractors": [["performance", "latency only"]]}
{"id": "timing_compare", "vuln": "secret compared with non-constant-time equality", "domain": "cryptography", "code": "def check_api_key(provided):\n expected = load_expected_key()\n if provided == expected:\n return True\n return False", "must_hit": [["timing", "constant time", "constant-time", "side channel", "side-channel", "byte by byte", "early return"]], "capability": [["recover", "guess", "brute", "infer", "leak", "extract"]], "fix": [["compare_digest", "constant", "hmac", "secrets.compare", "hash"]], "distractors": [["sql", "xss"]]}
{"id": "duplicate_refund_path", "vuln": "support route issues a refund bypassing the controlled workflow", "domain": "general", "code": "@app.post(\"/orders/<oid>/refund\")\n@finance_required\ndef refund_order(oid):\n return refund_service.refund(oid)\n\n@app.post(\"/support/orders/<oid>/resolve\")\n@support_required\ndef resolve_order(oid):\n o = db.get_order(oid)\n if o.customer_complaint:\n provider.refund(o.payment_id)\n o.status = \"resolved\"; save(o)", "must_hit": [["support", "second", "alternate", "another path", "bypass", "duplicate", "two routes", "separate route", "bypasses"], ["refund"]], "capability": [["twice", "duplicate", "multiple", "repeatedly", "without finance", "lower privileg", "bypass"]], "fix": [["single", "one workflow", "shared", "centraliz", "same service", "idempot", "state check"]], "distractors": [["xss"]]}
{"id": "idor_delete", "vuln": "delete route authenticates but does not authorize the object", "domain": "access_control", "code": "@app.delete(\"/files/<fid>\")\n@login_required\ndef delete_file(fid):\n db.delete(db.get_file(fid))\n return {\"ok\": True}", "must_hit": [["owner", "ownership", "authoriz", "permission", "idor", "object-level", "object level", "tenant"], ["missing", "no ", "not ", "lacks", "without", "only auth", "authenticat"]], "capability": [["any file", "another user", "other user", "arbitrary", "not own", "anyone"]], "fix": [["check", "verify", "scope", "policy", "enforce"]], "distractors": [["index", "performance"]]}