Zero Day Research Skill
When to Use
- When standard vulnerability scanning yields no results on a hardened target.
- When the target has open-source components or published source code.
- When you have access to compiled binaries/firmware that need reverse engineering.
- When hunting for vulnerabilities that are NOT in any public database or training data.
- When targeting custom frameworks, proprietary protocols, or internal APIs.
Prerequisites
- Strong understanding of memory corruption, logic flaws, and authentication patterns
- Source code access (GitHub, GitLab, leaked repos) OR binary analysis tools
- Static analysis tools: Semgrep, CodeQL, Joern
- Binary analysis: Ghidra, IDA Pro, or Radare2
- Claude Code CLI for AI-augmented code review
Core Concept
"We built a Zero Day Research skill using Eugene's book methodology —
it finds vulnerabilities in source code and binaries that normal training
data has never seen."
— Episode 166
Why AI + Source Code = Zero Days
AI training data contains known vulnerability patterns. Source code of YOUR target contains
unique business logic, custom parsers, and proprietary protocols that no AI has ever analyzed.
When you feed that source code to Claude with the right instructions, Claude finds patterns
similar to known bugs but in never-before-audited code.
Known Vuln Pattern (training data): SQL injection via string concatenation
Your Target's Code: Custom query builder with template literals
Claude's Finding: Template literal injection → zero day
Workflow
Phase 1: Source Code Acquisition
| Source |
How to Obtain |
Legal Status |
| Open-source dependencies |
npm, pip, Maven — package.json → GitHub |
✅ Public |
| Client-side JavaScript |
Browser DevTools → Sources tab → beautify |
✅ Public (delivered to you) |
| Mobile app decompilation |
APKTool / jadx (Android), Hopper (iOS) |
⚠️ Check program terms |
| Server-side source maps |
//# sourceMappingURL= in JS files |
✅ If accessible (misconfig = finding) |
| Git history exposure |
/.git/ directory on web server |
✅ If accessible (misconfig = finding) |
| Binary firmware |
Firmware update files from vendor site |
⚠️ Check program terms |
Phase 2: AI-Augmented Source Code Audit
The Zero Day Hunting Prompt:
You are a vulnerability researcher performing a source code security audit.
IMPORTANT: Do NOT rely on your training data for known CVEs. The goal is
to find NEW vulnerabilities that have never been reported.
Analyze the following code for:
1. INJECTION SINKS
- Any place user input reaches a dangerous function
- SQL: query builders, raw queries, ORM bypasses
- Command: exec(), system(), child_process
- Template: render(), eval(), new Function()
- Deserialization: JSON.parse() on untrusted data with prototype pollution
2. AUTHENTICATION/AUTHORIZATION FLAWS
- Missing auth checks on sensitive endpoints
- Role confusion (admin vs user permissions checked inconsistently)
- JWT validation gaps (alg:none, key confusion, missing expiry check)
- Session fixation or predictable session IDs
3. LOGIC FLAWS
- Race conditions in state transitions (TOCTOU)
- Integer overflow/underflow in payment or quantity logic
- Business logic bypass (skip steps in multi-step processes)
- Negative quantity / negative price attacks
4. INFORMATION DISCLOSURE
- Hardcoded secrets, API keys, internal URLs
- Verbose error handling that leaks implementation details
- Debug endpoints left in production code
5. MEMORY SAFETY (for C/C++/Rust unsafe blocks)
- Buffer overflow: unchecked array indexing, sprintf(), strcpy()
- Use-after-free: dangling pointers after deallocation
- Double-free: same memory freed twice
- Format string: printf(user_input) without format specifier
For each finding, provide:
- File and line number
- The vulnerable code snippet
- Proof of concept exploitation
- Severity assessment with CVSS 4.0
- Recommended fix with before/after code
Phase 3: Automated Static Analysis Pipeline
// scripts/zero-day-scan.ts
#!/usr/bin/env npx tsx
import { execSync } from "child_process";
import { existsSync, readFileSync, writeFileSync } from "fs";
interface ScanResult {
tool: string;
file: string;
line: number;
rule: string;
severity: string;
message: string;
}
// Tier 1: Semgrep (fast, pattern-based)
function runSemgrep(targetDir: string): ScanResult[] {
try {
const output = execSync(
`semgrep --config=auto --json --quiet "${targetDir}" 2>/dev/null`,
{ maxBuffer: 50 * 1024 * 1024 }
).toString();
const data = JSON.parse(output);
return (data.results || []).map((r: any) => ({
tool: "semgrep",
file: r.path,
line: r.start?.line || 0,
rule: r.check_id,
severity: r.extra?.severity || "WARNING",
message: r.extra?.message || r.check_id,
}));
} catch {
console.warn("[SKIP] Semgrep not available or failed");
return [];
}
}
// Tier 2: Custom grep patterns for high-signal sinks
function runCustomPatterns(targetDir: string): ScanResult[] {
const DANGEROUS_PATTERNS = [
{ pattern: "eval\\(", rule: "code-injection-eval", severity: "HIGH" },
{ pattern: "child_process", rule: "command-injection-sink", severity: "HIGH" },
{ pattern: "dangerouslySetInnerHTML", rule: "xss-react-dangerous", severity: "MEDIUM" },
{ pattern: "document\\.write", rule: "xss-dom-write", severity: "MEDIUM" },
{ pattern: "\\.query\\(.*\\+", rule: "sqli-concatenation", severity: "CRITICAL" },
{ pattern: "JSON\\.parse\\(.*req\\.", rule: "prototype-pollution-risk", severity: "MEDIUM" },
{ pattern: "jwt\\.decode", rule: "jwt-decode-no-verify", severity: "HIGH" },
{ pattern: "password.*=.*[\"']", rule: "hardcoded-credential", severity: "CRITICAL" },
{ pattern: "BEGIN (RSA |EC )?PRIVATE KEY", rule: "exposed-private-key", severity: "CRITICAL" },
{ pattern: "TODO.*hack|FIXME.*security|XXX.*vuln", rule: "dev-security-note", severity: "INFO" },
];
const results: ScanResult[] = [];
for (const { pattern, rule, severity } of DANGEROUS_PATTERNS) {
try {
const output = execSync(
`rg -n --json "${pattern}" "${targetDir}" --type-add "code:*.{js,ts,py,java,go,rb,php,cs}" --type code 2>/dev/null || true`,
{ maxBuffer: 10 * 1024 * 1024 }
).toString();
for (const line of output.split("\n").filter(Boolean)) {
try {
const match = JSON.parse(line);
if (match.type === "match") {
results.push({
tool: "custom-grep",
file: match.data.path.text,
line: match.data.line_number,
rule,
severity,
message: match.data.lines.text.trim().substring(0, 200),
});
}
} catch { /* skip malformed lines */ }
}
} catch { /* pattern error — skip */ }
}
return results;
}
// Main
const targetDir = process.argv[2];
if (!targetDir) {
console.error("Usage: npx tsx zero-day-scan.ts <source-code-directory>");
process.exit(1);
}
console.log(`🔬 Zero Day Research Scan: ${targetDir}\n`);
const semgrepResults = runSemgrep(targetDir);
const customResults = runCustomPatterns(targetDir);
const allResults = [...semgrepResults, ...customResults];
// Deduplicate by file+line
const seen = new Set<string>();
const unique = allResults.filter((r) => {
const key = `${r.file}:${r.line}`;
if (seen.has(key)) return false;
seen.add(key);
return true;
});
// Group by severity
const bySeverity = { CRITICAL: [] as ScanResult[], HIGH: [] as ScanResult[], MEDIUM: [] as ScanResult[], LOW: [] as ScanResult[], INFO: [] as ScanResult[] };
for (const r of unique) {
(bySeverity[r.severity as keyof typeof bySeverity] || bySeverity.INFO).push(r);
}
console.log(`Results: ${unique.length} potential findings`);
for (const [sev, results] of Object.entries(bySeverity)) {
if (results.length === 0) continue;
console.log(`\n--- ${sev} (${results.length}) ---`);
for (const r of results.slice(0, 10)) {
console.log(` ${r.file}:${r.line} [${r.rule}] ${r.message.substring(0, 80)}`);
}
}
// Save full results
const outputPath = `zero-day-scan-results-${Date.now()}.json`;
writeFileSync(outputPath, JSON.stringify(unique, null, 2));
console.log(`\nFull results saved to: ${outputPath}`);
Phase 4: Binary Analysis Integration
For compiled binaries without source code:
Prompt for Claude:
"Analyze this decompiled function output from Ghidra. Look for:
- Buffer overflow via unbounded memcpy/strcpy
- Integer overflow in size calculations
- Use-after-free patterns
- Format string vulnerabilities
- Weak cryptographic implementations
The function handles user authentication via a custom binary protocol.
[Paste decompiled pseudocode here]"
Tool pipeline:
flowchart LR
A["Binary / Firmware"] --> B["Ghidra / IDA Pro<br/>Decompile"]
B --> C["Claude Analysis<br/>Pattern Matching"]
C --> D{"Vulnerability<br/>Found?"}
D -->|Yes| E["Write PoC Exploit"]
D -->|No| F["Refine analysis<br/>Focus on auth/crypto"]
G["Source Code"] --> H["Semgrep + CodeQL<br/>Static Analysis"]
H --> C
Key Patterns to Hunt
| Pattern |
Why It's a Zero Day |
Where to Look |
| Custom query builders |
Not in SQLi training data — unique SQL construction |
ORM wrappers, search functions |
| Homegrown auth |
No CVE exists for custom auth code |
Login, session, token generation |
| Protocol parsers |
Custom binary protocols have no scanner signatures |
Network handlers, file format parsers |
| State machines |
Race conditions in custom workflows |
Payment flows, approval chains |
| Crypto implementations |
"Don't roll your own crypto" — but people do |
Token generation, password hashing |
Creativity Directive
IMPORTANT: The instructions above are a STARTING POINT.
Feed Claude entire codebases, not just snippets. Look for architectural
flaws, not just individual lines. Build custom Semgrep rules for patterns
unique to the target's tech stack. Chain static analysis findings into
full exploit chains.
Think like an attacker. Adapt. Improvise.
🔵 Blue Team
- Deploy robust WAF rules to detect anomalies.
- Monitor logs for unusual access patterns.
🛡️ Remediation & Mitigation Strategy
- Input Validation: Sanitize and strictly type-check all inputs.
- Least Privilege: Constrain component execution bounds.
📚 Shared Resources
For cross-cutting methodology applicable to all vulnerability classes, see:
References
1---2name: zero-day-research-skill3description: >4 Systematic zero-day vulnerability research in source code and compiled binaries.5 Find bugs that scanners and AI training data have never seen. Based on Critical6 Thinking Bug Bounty Podcast Episode 166 and Eugene's methodology.7domain: cybersecurity8subdomain: bug-hunting9category: Methodology10difficulty: expert11estimated_time: "8-40 hours"12platforms: [linux, macos, windows]13tags: [zero-day, source-code-audit, binary-analysis, vulnerability-research, 0day, code-review, reverse-engineering]14tools: [claude-code-cli, semgrep, codeql, ghidra, ida-pro, radare2, typescript]15version: "1.0"16author: CyberSkills-Elite17license: Apache-2.018source: "Critical Thinking Bug Bounty Podcast Ep. 166"19source_url: "http://www.youtube.com/watch?v=qTX9u-EsjmM"20metadata:21 source: https://skillmd.com/skills/shulkwisec/zero-day-research-skill22---2324# Zero Day Research Skill2526## When to Use27- When standard vulnerability scanning yields no results on a hardened target.28- When the target has open-source components or published source code.29- When you have access to compiled binaries/firmware that need reverse engineering.30- When hunting for vulnerabilities that are NOT in any public database or training data.31- When targeting custom frameworks, proprietary protocols, or internal APIs.3233## Prerequisites34- Strong understanding of memory corruption, logic flaws, and authentication patterns35- Source code access (GitHub, GitLab, leaked repos) OR binary analysis tools36- Static analysis tools: Semgrep, CodeQL, Joern37- Binary analysis: Ghidra, IDA Pro, or Radare238- Claude Code CLI for AI-augmented code review3940## Core Concept4142> **"We built a Zero Day Research skill using Eugene's book methodology —43> it finds vulnerabilities in source code and binaries that normal training44> data has never seen."**45> — Episode 1664647### Why AI + Source Code = Zero Days4849AI training data contains known vulnerability patterns. Source code of YOUR target contains50**unique business logic, custom parsers, and proprietary protocols** that no AI has ever analyzed.51When you feed that source code to Claude with the right instructions, Claude finds patterns52similar to known bugs but in never-before-audited code.5354```55Known Vuln Pattern (training data): SQL injection via string concatenation56Your Target's Code: Custom query builder with template literals57Claude's Finding: Template literal injection → zero day58```5960## Workflow6162### Phase 1: Source Code Acquisition6364| Source | How to Obtain | Legal Status |65|--------|---------------|-------------|66| Open-source dependencies | npm, pip, Maven — `package.json` → GitHub | ✅ Public |67| Client-side JavaScript | Browser DevTools → Sources tab → beautify | ✅ Public (delivered to you) |68| Mobile app decompilation | APKTool / jadx (Android), Hopper (iOS) | ⚠️ Check program terms |69| Server-side source maps | `//# sourceMappingURL=` in JS files | ✅ If accessible (misconfig = finding) |70| Git history exposure | `/.git/` directory on web server | ✅ If accessible (misconfig = finding) |71| Binary firmware | Firmware update files from vendor site | ⚠️ Check program terms |7273### Phase 2: AI-Augmented Source Code Audit7475**The Zero Day Hunting Prompt:**76```77You are a vulnerability researcher performing a source code security audit.7879IMPORTANT: Do NOT rely on your training data for known CVEs. The goal is 80to find NEW vulnerabilities that have never been reported.8182Analyze the following code for:83841. INJECTION SINKS85 - Any place user input reaches a dangerous function86 - SQL: query builders, raw queries, ORM bypasses87 - Command: exec(), system(), child_process88 - Template: render(), eval(), new Function()89 - Deserialization: JSON.parse() on untrusted data with prototype pollution90912. AUTHENTICATION/AUTHORIZATION FLAWS92 - Missing auth checks on sensitive endpoints93 - Role confusion (admin vs user permissions checked inconsistently)94 - JWT validation gaps (alg:none, key confusion, missing expiry check)95 - Session fixation or predictable session IDs96973. LOGIC FLAWS98 - Race conditions in state transitions (TOCTOU)99 - Integer overflow/underflow in payment or quantity logic100 - Business logic bypass (skip steps in multi-step processes)101 - Negative quantity / negative price attacks1021034. INFORMATION DISCLOSURE104 - Hardcoded secrets, API keys, internal URLs105 - Verbose error handling that leaks implementation details106 - Debug endpoints left in production code1071085. MEMORY SAFETY (for C/C++/Rust unsafe blocks)109 - Buffer overflow: unchecked array indexing, sprintf(), strcpy()110 - Use-after-free: dangling pointers after deallocation111 - Double-free: same memory freed twice112 - Format string: printf(user_input) without format specifier113114For each finding, provide:115- File and line number116- The vulnerable code snippet117- Proof of concept exploitation118- Severity assessment with CVSS 4.0119- Recommended fix with before/after code120```121122### Phase 3: Automated Static Analysis Pipeline123124```typescript125// scripts/zero-day-scan.ts126#!/usr/bin/env npx tsx127128import { execSync } from "child_process";129import { existsSync, readFileSync, writeFileSync } from "fs";130131interface ScanResult {132 tool: string;133 file: string;134 line: number;135 rule: string;136 severity: string;137 message: string;138}139140// Tier 1: Semgrep (fast, pattern-based)141function runSemgrep(targetDir: string): ScanResult[] {142 try {143 const output = execSync(144 `semgrep --config=auto --json --quiet "${targetDir}" 2>/dev/null`,145 { maxBuffer: 50 * 1024 * 1024 }146 ).toString();147 const data = JSON.parse(output);148 return (data.results || []).map((r: any) => ({149 tool: "semgrep",150 file: r.path,151 line: r.start?.line || 0,152 rule: r.check_id,153 severity: r.extra?.severity || "WARNING",154 message: r.extra?.message || r.check_id,155 }));156 } catch {157 console.warn("[SKIP] Semgrep not available or failed");158 return [];159 }160}161162// Tier 2: Custom grep patterns for high-signal sinks163function runCustomPatterns(targetDir: string): ScanResult[] {164 const DANGEROUS_PATTERNS = [165 { pattern: "eval\\(", rule: "code-injection-eval", severity: "HIGH" },166 { pattern: "child_process", rule: "command-injection-sink", severity: "HIGH" },167 { pattern: "dangerouslySetInnerHTML", rule: "xss-react-dangerous", severity: "MEDIUM" },168 { pattern: "document\\.write", rule: "xss-dom-write", severity: "MEDIUM" },169 { pattern: "\\.query\\(.*\\+", rule: "sqli-concatenation", severity: "CRITICAL" },170 { pattern: "JSON\\.parse\\(.*req\\.", rule: "prototype-pollution-risk", severity: "MEDIUM" },171 { pattern: "jwt\\.decode", rule: "jwt-decode-no-verify", severity: "HIGH" },172 { pattern: "password.*=.*[\"']", rule: "hardcoded-credential", severity: "CRITICAL" },173 { pattern: "BEGIN (RSA |EC )?PRIVATE KEY", rule: "exposed-private-key", severity: "CRITICAL" },174 { pattern: "TODO.*hack|FIXME.*security|XXX.*vuln", rule: "dev-security-note", severity: "INFO" },175 ];176177 const results: ScanResult[] = [];178 for (const { pattern, rule, severity } of DANGEROUS_PATTERNS) {179 try {180 const output = execSync(181 `rg -n --json "${pattern}" "${targetDir}" --type-add "code:*.{js,ts,py,java,go,rb,php,cs}" --type code 2>/dev/null || true`,182 { maxBuffer: 10 * 1024 * 1024 }183 ).toString();184185 for (const line of output.split("\n").filter(Boolean)) {186 try {187 const match = JSON.parse(line);188 if (match.type === "match") {189 results.push({190 tool: "custom-grep",191 file: match.data.path.text,192 line: match.data.line_number,193 rule,194 severity,195 message: match.data.lines.text.trim().substring(0, 200),196 });197 }198 } catch { /* skip malformed lines */ }199 }200 } catch { /* pattern error — skip */ }201 }202 return results;203}204205// Main206const targetDir = process.argv[2];207if (!targetDir) {208 console.error("Usage: npx tsx zero-day-scan.ts <source-code-directory>");209 process.exit(1);210}211212console.log(`🔬 Zero Day Research Scan: ${targetDir}\n`);213214const semgrepResults = runSemgrep(targetDir);215const customResults = runCustomPatterns(targetDir);216const allResults = [...semgrepResults, ...customResults];217218// Deduplicate by file+line219const seen = new Set<string>();220const unique = allResults.filter((r) => {221 const key = `${r.file}:${r.line}`;222 if (seen.has(key)) return false;223 seen.add(key);224 return true;225});226227// Group by severity228const bySeverity = { CRITICAL: [] as ScanResult[], HIGH: [] as ScanResult[], MEDIUM: [] as ScanResult[], LOW: [] as ScanResult[], INFO: [] as ScanResult[] };229for (const r of unique) {230 (bySeverity[r.severity as keyof typeof bySeverity] || bySeverity.INFO).push(r);231}232233console.log(`Results: ${unique.length} potential findings`);234for (const [sev, results] of Object.entries(bySeverity)) {235 if (results.length === 0) continue;236 console.log(`\n--- ${sev} (${results.length}) ---`);237 for (const r of results.slice(0, 10)) {238 console.log(` ${r.file}:${r.line} [${r.rule}] ${r.message.substring(0, 80)}`);239 }240}241242// Save full results243const outputPath = `zero-day-scan-results-${Date.now()}.json`;244writeFileSync(outputPath, JSON.stringify(unique, null, 2));245console.log(`\nFull results saved to: ${outputPath}`);246```247248### Phase 4: Binary Analysis Integration249250For compiled binaries without source code:251252```253Prompt for Claude:254"Analyze this decompiled function output from Ghidra. Look for:255- Buffer overflow via unbounded memcpy/strcpy256- Integer overflow in size calculations257- Use-after-free patterns 258- Format string vulnerabilities259- Weak cryptographic implementations260261The function handles user authentication via a custom binary protocol.262[Paste decompiled pseudocode here]"263```264265**Tool pipeline:**266```mermaid267flowchart LR268 A["Binary / Firmware"] --> B["Ghidra / IDA Pro<br/>Decompile"]269 B --> C["Claude Analysis<br/>Pattern Matching"]270 C --> D{"Vulnerability<br/>Found?"}271 D -->|Yes| E["Write PoC Exploit"]272 D -->|No| F["Refine analysis<br/>Focus on auth/crypto"]273 274 G["Source Code"] --> H["Semgrep + CodeQL<br/>Static Analysis"]275 H --> C276```277278## Key Patterns to Hunt279280| Pattern | Why It's a Zero Day | Where to Look |281|---------|-------------------|---------------|282| Custom query builders | Not in SQLi training data — unique SQL construction | ORM wrappers, search functions |283| Homegrown auth | No CVE exists for custom auth code | Login, session, token generation |284| Protocol parsers | Custom binary protocols have no scanner signatures | Network handlers, file format parsers |285| State machines | Race conditions in custom workflows | Payment flows, approval chains |286| Crypto implementations | "Don't roll your own crypto" — but people do | Token generation, password hashing |287288## Creativity Directive289290> **IMPORTANT**: The instructions above are a STARTING POINT.291> Feed Claude entire codebases, not just snippets. Look for architectural292> flaws, not just individual lines. Build custom Semgrep rules for patterns293> unique to the target's tech stack. Chain static analysis findings into294> full exploit chains.295> **Think like an attacker. Adapt. Improvise.**296297## 🔵 Blue Team298- Deploy robust WAF rules to detect anomalies.299- Monitor logs for unusual access patterns.300301## 🛡️ Remediation & Mitigation Strategy302- **Input Validation:** Sanitize and strictly type-check all inputs.303- **Least Privilege:** Constrain component execution bounds.304305306## 📚 Shared Resources307> For cross-cutting methodology applicable to all vulnerability classes, see:308> - [`_shared/references/elite-chaining-strategy.md`](../_shared/references/elite-chaining-strategy.md) — Exploit chaining methodology and high-payout chain patterns309> - [`_shared/references/elite-report-writing.md`](../_shared/references/elite-report-writing.md) — HackerOne-optimized report writing, CWE quick reference310> - [`_shared/references/real-world-bounties.md`](../_shared/references/real-world-bounties.md) — Verified disclosed bounties by vulnerability class311312## References313- Source: [Critical Thinking Ep. 166](http://www.youtube.com/watch?v=qTX9u-EsjmM)314- Semgrep Rules: [https://semgrep.dev/r](https://semgrep.dev/r)315- CodeQL Queries: [https://codeql.github.com/](https://codeql.github.com/)316- The Web Application Hacker's Handbook (Stuttard & Pinto)