DetAnom is a system for detecting anomalous SQL queries from insider threats. It profiles application behavior and flags or blocks unauthorized database access.
- Profile Builder (
profile_builder.py): Generates query signatures and constraints from thesalaryAdjustmentprogram. - Anomaly Detector (
anomaly_detector.py): Validates runtime queries against the profile using strict or flexible policies.
- Profiles SQL queries based on input-driven conditions.
- Generates schema-based query signatures.
- Captures execution constraints (e.g.,
profit >= 0.5 * investment). - Strict: block anomalies; Flexible: flag anomalies.
- Uses in-memory SQLite DB.
- Logs for verification and debugging.
python profile_builder.pyGenerates application_profile.json with 4 query entries.
python anomaly_detector.pyChecks incoming queries against the profile.
INFO - Query passed: SELECT employee_id, salary FROM PersonalInfo WHERE salary > 50000
ERROR - Anomaly detected: SELECT employee_id FROM PersonalInfo WHERE salary < 1000
- Python 3.8+
- SQLite (standard library)
DetAnom/
├── profile_builder.py
├── anomaly_detector.py
├── application_profile.json
└── README.md
- Paper: DetAnom: Detecting Anomalous Database Transactions by Insiders, Hussain et al., 2015