NullSec TaintTrack
February 27, 2026 Β· View on GitHub
Taint Analysis Engine
A static taint analysis tool written in OCaml, demonstrating functional programming with strong static typing for vulnerability detection through data flow analysis.
π― Overview
NullSec TaintTrack performs static taint analysis to trace data flow from untrusted sources (user input, network data) to security-sensitive sinks (SQL queries, command execution), identifying injection vulnerabilities.
β¨ Features
- Source Tracking - Monitor user input, network data, file reads
- Sink Detection - SQL queries, command execution, file writes
- Flow Analysis - Trace data through program paths
- Sanitizer Recognition - Detect when data is properly sanitized
- CWE Mapping - Common Weakness Enumeration references
- MITRE ATT&CK - Technique identification
π Vulnerability Detection
| Vulnerability | Source β Sink | CWE | MITRE |
|---|---|---|---|
| SQL Injection | UserInput β SQLQuery | CWE-89 | T1190 |
| Command Injection | UserInput β CommandExec | CWE-78 | T1059 |
| XSS | UserInput β HTMLOutput | CWE-79 | T1189 |
| Path Traversal | UserInput β FileWrite | CWE-22 | T1083 |
| SSRF | UserInput β NetworkSend | CWE-918 | T1090 |
| Log Injection | UserInput β LogOutput | CWE-117 | T1070 |
| Code Injection | UserInput β Eval | CWE-94 | T1059 |
π¦ Installation
# Clone the repository
git clone https://github.com/bad-antics/nullsec-tainttrack
cd nullsec-tainttrack
# Compile with ocamlfind
ocamlfind ocamlopt -o tainttrack tainttrack.ml
# Or compile with ocamlopt directly
ocamlopt -o tainttrack tainttrack.ml
# Run without compilation
ocaml tainttrack.ml
π Usage
# Analyze source directory
./tainttrack src/
# JSON output
./tainttrack -j project/
# Verbose mode
./tainttrack -v app/
# List sources and sinks
./tainttrack --sources
./tainttrack --sinks
# Run demo mode
./tainttrack
π» Example Output
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NullSec TaintTrack - Taint Analysis Engine β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[Demo Mode]
Analyzing sample taint flows...
Analyzed 7 flows, found 6 vulnerabilities
[CRITICAL] SQL Injection
Source: USER_INPUT
Sink: SQL_QUERY
CWE: CWE-89
MITRE: T1190
Data Flow:
β request.params['id'] (app.py:45)
β user_id (app.py:46)
β db.execute(query) (app.py:50)
[CRITICAL] Command Injection
Source: NETWORK_DATA
Sink: COMMAND_EXEC
CWE: CWE-78
MITRE: T1059
Data Flow:
β socket.recv() (server.py:100)
β cmd_data (server.py:101)
β os.system(cmd) (server.py:105)
[HIGH] Cross-Site Scripting
Source: USER_INPUT
Sink: HTML_OUTPUT
CWE: CWE-79
MITRE: T1189
Data Flow:
β request.args['name'] (views.py:20)
β username (views.py:21)
β render_template() (views.py:25)
βββββββββββββββββββββββββββββββββββββββββββ
Summary:
Total Findings: 6
Critical: 2
High: 3
Medium: 1
Low: 0
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Source Code Parser β
β Python | JavaScript | Java | PHP β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Data Flow Graph Builder β
β Track variable assignments and propagation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
β Source β βPropagate β β Sink β
β Finder β β Taint β β Finder β
ββββββββββββ ββββββββββββ ββββββββββββ
β β β
βββββββββββββββββΌββββββββββββββββ
βΌ
ββββββββββββββββ
βVulnerability β
βClassificationβ
ββββββββββββββββ
Ξ» OCaml Features Demonstrated
- Variant Types -
taint_source,taint_sink,vulnerability - Pattern Matching - Exhaustive case analysis
- Option Types -
vulnerability optionfor maybe values - Records -
flow_node,taint_flow,finding - Higher-Order Functions -
List.filter_map,List.iter - Modules -
Colormodule for ANSI codes - Type Inference - Automatic type deduction
- Immutability - Default immutable data structures
π§ Type Definitions
(* Taint flow record *)
type taint_flow = {
source: taint_source;
sink: taint_sink;
nodes: flow_node list;
vulnerability: vulnerability option;
}
(* Analysis finding *)
type finding = {
severity: severity;
flow: taint_flow;
description: string;
cwe: string;
}
π Taint Sources
| Source | Description |
|---|---|
| UserInput | HTTP parameters, form data |
| NetworkData | Socket recv, API responses |
| FileRead | File contents |
| EnvironmentVar | Environment variables |
| DatabaseQuery | Database results |
| ExternalAPI | Third-party API data |
| CommandLine | CLI arguments |
π‘οΈ Security Use Cases
- SAST - Static Application Security Testing
- Code Review - Automated vulnerability detection
- CI/CD Integration - Pre-commit security checks
- Compliance - OWASP Top 10 detection
- Training - Security awareness examples
β οΈ Legal Disclaimer
This tool is intended for:
- β Authorized code review
- β Security testing of owned applications
- β Educational purposes
- β Research and development
Only analyze code you're authorized to review.
π Links
- Portal: bad-antics.github.io
- Twitter: x.com/AnonAntics
- GitHub: github.com/bad-antics
π License
MIT License - See LICENSE file for details.
π·οΈ Version History
- v1.0.0 - Initial release with taint analysis and vulnerability classification
Part of the NullSec Security Toolkit