A backend analysis engine that detects suspicious process execution chains from OS-level telemetry.
This system:
- Consumes normalized Sysmon for Linux process creation events (Event ID 1)
- Learns a baseline of normal execution behavior
- Flags deviations as explainable anomalies
- Produces structured analysis reports
✅ Complete — All 8 phases implemented
# Clone repository
git clone https://github.com/BhaveshBytess/sys-provenance-graph.git
cd sys-provenance-graph
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: .\venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt# Train baseline from events
python -m src.cli.main train -i events.json -o baseline.json
# Analyze events against baseline
python -m src.cli.main analyze -i events.json -b baseline.json
# Output to file
python -m src.cli.main analyze -i events.json -b baseline.json -o report.json
# Pretty-print JSON
python -m src.cli.main analyze -i events.json -b baseline.json --pretty# Start API server
BASELINE_PATH=baseline.json uvicorn src.api.main:app --host 0.0.0.0 --port 8000
# Health check
curl http://localhost:8000/health
# Analyze events
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"events": [...]}'docker build -t sba:latest .docker run -p 8000:8000 \
-v $(pwd)/baseline.json:/data/baseline.json:ro \
-e BASELINE_PATH=/data/baseline.json \
sba:latest# Create data directory with baseline
mkdir -p data
# (place baseline.json in data/)
# Start services
docker-compose up --build -d
# View logs
docker-compose logs -f api
# Stop
docker-compose downsys-provenance-graph/
├── active_context.md # Session control entrypoint
├── docs/ # 7-file governance framework (project-level)
│ ├── contracts.md
│ ├── agent_project.md
│ ├── agent_core.md
│ ├── build_plan.md
│ ├── decisions.md
│ └── state.md
├── governance/ # Reusable templates and bootstrap tools
├── src/
│ ├── core/
│ │ ├── events.py # Pydantic data models
│ │ ├── loader.py # Sysmon event parser
│ │ ├── analyzer.py # Detection engine
│ │ └── pipeline.py # Shared analysis pipeline
│ ├── adapters/
│ │ └── mordor_adapter.py # Mordor JSONL -> CanonicalEvent adapter
│ ├── cli/
│ │ └── main.py # CLI interface (Typer)
│ └── api/
│ └── main.py # REST API (FastAPI)
├── scripts/
│ ├── mordor_smoke_test.py # Baseline/test smoke run against Mordor datasets
│ └── mordor_split_test.py # 70/30 split-baseline smoke run
├── tests/ # Unit tests
├── Dockerfile # Production container
├── docker-compose.yml # Deployment config
├── requirements.txt # Python dependencies
├── VALIDATION.md # Latest validation evidence and outcomes
└── README.md
active_context.md— Session entrypoint and governance orderdocs/contracts.md— Immutable system contracts and invariantsdocs/agent_project.md— Project-specific constraints and domain rulesdocs/agent_core.md— Reusable execution and debugging disciplinedocs/build_plan.md— Module dependency graph and exit gatesdocs/decisions.md— Architecture decision recordsdocs/state.md— Current system state and session logSPEC.md— System architecture and responsibilitiesgovernance/— 7-file framework templates and bootstrap toolsVALIDATION.md— Validation runbook and latest execution evidence
Run adapter tests:
python -m pytest -q tests/test_mordor_adapter.pyRun smoke test with explicit dataset paths:
python scripts/mordor_smoke_test.py \
--baseline-file examples/mordor/psh_python_webserver_2020-10-2900161507.json \
--test-file examples/mordor/metasploit_logonpasswords_lsass_memory_dump.json \
--output examples/mordor/smoke_test_report.jsonRun split-baseline smoke test:
python scripts/mordor_split_test.py \
--input-file examples/mordor/metasploit_logonpasswords_lsass_memory_dump.json \
--output examples/mordor/split_test_report.json| Phase | Component | Tests |
|---|---|---|
| 1 | Data Contracts | 20 |
| 2 | Loader | 27 |
| 3 | Baseline | 28 |
| 4 | Detection | 19 |
| 5 | Chain Reconstruction | 21 |
| 6 | Report Assembly | 17 |
| 7 | CLI & API | 21 |
| Total | 153 |
Run all tests:
pytest -v- Python 3.10+
- See
requirements.txtfor dependencies
This system has been validated against real-world Sysmon telemetry from the OTRF Mordor Security Datasets, including benign activity and LSASS credential-dumping attack campaigns.
Key results:
- Cross-dataset test: demonstrated baseline sensitivity - undersized baselines produce 99% false positive rate
- Same-environment 70/30 split: 1 true anomaly detected out of 269 events, zero false positives
- Graph-enriched analysis: added 3 structural risk factors explaining WHY the detection is suspicious
- See VALIDATION.md for full experiment details and methodology
v1.1 adds a graph analysis layer (NetworkX) that models process relationships as a directed graph and enriches anomaly results with structural risk factors for explainability.
Internal use only.