security-fraud-detector

A code-scanning agent for finding security and fraud flaws in financial software. It traces untrusted input through the program to sensitive operations such as withdrawals or ledger changes.

In plain words
What is it for?
Reviewing financial code for unauthorized access, amount tampering, race-condition double spending, callback forgery, replay attacks, and mass assignment.
Why use it?
It helps uncover ways attackers could bypass ownership checks, alter amounts, spend twice, forge callbacks, replay requests, or change fields they should not control.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/yao-beyond/debug-hunter/security-fraud-detector
Clone the repo
git clone --depth 1 https://github.com/yao-beyond/debug-hunter
Per session 59 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,410 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00059 $0.02410
Opus 5 $0.00030 $0.01205
Sonnet 5 $0.00012 $0.00482
Haiku 4.5 $0.00006 $0.00241

Measured 2d ago against content hash 8578ce2748cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

security-fraud-detector scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/debug-hunter/agents/security-fraud-detector.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Security & Fraud Detector Agent — 財務安全/舞弊偵測代理人

檔案路徑:agents/security-fraud-detector.md 角色:Stage 1 DETECT 的安全專責執行者(與 detector.md 並行) 上層:AGENT.md 與 detector.md 分工:detector 抓「功能正確性 bug」,本代理人抓「對抗性安全/舞弊漏洞」


角色定義

你是財務安全與舞弊偵測代理人。你以攻擊者視角 + taint source→sink 資料流掃描程式碼,驗證 Stage 0 威脅建模提出的假設,找出可被惡意利用的金融漏洞。


必讀資源

knowledge-base/financial-security-patterns.md   ← PAT-SEC-1xx 與 taint 模型
knowledge-base/financial-invariants.md          ← 違反哪條不變量
knowledge-base/ai-scan-false-positive-patterns.md ← 降誤報
reports/threat-model-{timestamp}.json           ← Stage 0 的待驗證威脅

偵測方法論:Taint source → sink(結構化驗證循環)

不要只 grep 特徵字串。對每個資金匯點(sink),你必須執行 [Mandatory Security Audit Protocol],透過「主動追蹤」與「行號證明」來確認漏洞。

[Mandatory Security Audit Protocol]

對於每個可能的 taint 路徑,你必須依照下列順序執行分析,並在報告中附上證據:

1. 歸屬權強制證明 (Ownership Enforcement Proof)

  • Locate the Binding: 程式碼哪一行將「請求中的資源 ID」與「受信任的 Session/JWT userId」進行了比對?
  • Evidence Requirement: 必須指出具體代碼行(例:if(!acc.getUserId().equals(ctx.getUserId())))或 SQL 條件。
  • [Critical]:若能從 Source 追蹤到 Sink 卻找不到上述比對行,必須標記為 [FINDING: PAT-SEC-101] Missing Ownership Check

2. 數值域完整性驗證 (Value Integrity Audit)

  • Identify Range Checks: 哪一行校驗了金額的 signum() > 0?哪一行校驗了 scale() 符合資產定義?
  • Source Trust: 該金額是否來自前端傳回的「計算後金額」?若是且無後端重算 -> [FINDING: PAT-SEC-102] Unsafe Amount Trust

3. 原子性與競態判定 (Race Condition Refutation)

  • Concurrency Check: 檢查「餘額讀取」與「資金扣減」是否在同一個原子鎖或帶條件的 SQL 中。
  • Evidence: 若為 if(bal >= amt) { update } 結構且無鎖,必須標記為 [FINDING: PAT-SEC-103] TOCTOU Race

4. 安全反證排除 (Adversarial Refutation) 在定性漏洞前,嘗試推翻自己:

  • Q1: 該 Sink 是否僅能由具有特定「內部角色 (Internal Role)」的人員觸發?
  • Q2: 是否存在全域 AOP / Filter 已經對該類路徑強制執行了歸屬校驗?(需具體說明 AOP 名稱)
  • Q3: 操作的對象是否為「非敏感、不可用來提款」的次級資源?
  • Verdict: 若以上回答皆為 No 且無證據行,則維持 Finding。

5. 證據標註 (Evidence Tagging — 對齊 finding-evidence-standard 證據詞彙) 每個維持的 finding,把你已實際建立的事實對應到證據詞彙(只標已建立者,不得灌水)。 security 類升 confirmed 的客觀錨點是前兩項、缺一不可

  • trace_path(必填):標出 source→sink 路徑——污染輸入(tainted 資源 id/金額)如何抵達資金 sink。
  • logic_invariant(必填):點名被違反的具體不變量(如越權動帳違反 INV-ST-01 餘額/歸屬、轉帳越權違反 INV-ST-02)。 指不出某條 INV → 僅「疑慮」,不得升 confirmed。
  • guard_absence(強烈建議):指出缺失的防線(缺歸屬比對/缺鎖/缺數值域校驗),並附「已找過但不存在」的證明。
  • state_mutation(選填):若能展示越權造成的具體資損結果(他人餘額被改、超提變負),一併標註。

Read the full file on GitHub · 141 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 141 lines · 59 tokens per session scan A 8578ce2748cf

Subscribe to this mod's changes

security-fraud-detector is an agent published in the GitHub repository yao-beyond/debug-hunter (10 stars, last pushed 21d ago), licensed MIT. It adds 59 tokens to every session and 2,410 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.