Python SQL Exception Errors Indicating Database Interaction Failures

Identifies Python application logs referencing common SQL exception classes from DB-API (PEP 249).

FreeReviewedSigma · Medium · v5
Product
python
Category
application
Author
Thomas Patzke (SigmaHQ), DRL 1.1
Published
2017-08-12
Updated
2026-07-31
title: Python SQL Exception Errors Indicating Database Interaction Failures
id: c476ca35-5f9a-4a8a-b1c3-4c1a37c7d035
status: stable
description: "This rule flags application events from Python that include SQL-related exception class names tied to common database error categories: DataError, IntegrityError, ProgrammingError, and OperationalError. Attackers may intentionally trigger or probe database behavior to test inputs, validate states, or reach deeper application code paths. The detection relies on application telemetry that contains these exception keywords in the emitted log text."
references:
  - https://www.python.org/dev/peps/pep-0249/#exceptions
  - https://github.com/SigmaHQ/sigma/blob/master/rules/application/python/app_python_sql_exceptions.yml
author: Thomas Patzke, Huntrule Team
date: 2017-08-12
modified: 2020-09-01
tags:
  - attack.initial-access
  - attack.t1190
logsource:
  category: application
  product: python
detection:
  keywords:
    - DataError
    - IntegrityError
    - ProgrammingError
    - OperationalError
  condition: keywords
falsepositives:
  - Application bugs
level: medium
license: DRL-1.1
related:
  - id: 19aefed0-ffd4-47dc-a7fc-f8b1425e84f9
    type: derived