Detection rules › Sigma

SQL Injection Strings In URI

Status
test
Severity
high
Log source
category webserver
Author
Saw Win Naung, Nasreddine Bencherchali (Nextron Systems), Thurein Oo (Yoma Bank)
Source
github.com/SigmaHQ/sigma

Detects potential SQL injection attempts via GET requests in access logs.

MITRE ATT&CK coverage

TacticTechniques
Initial AccessT1190 Exploit Public-Facing Application

Rule body yaml

title: SQL Injection Strings In URI
id: 5513deaf-f49a-46c2-a6c8-3f111b5cb453
status: test
description: Detects potential SQL injection attempts via GET requests in access logs.
references:
    - https://www.acunetix.com/blog/articles/exploiting-sql-injection-example/
    - https://www.acunetix.com/blog/articles/using-logs-to-investigate-a-web-application-attack/
    - https://brightsec.com/blog/sql-injection-payloads/
    - https://github.com/payloadbox/sql-injection-payload-list
    - https://book.hacktricks.xyz/pentesting-web/sql-injection/mysql-injection
author: Saw Win Naung, Nasreddine Bencherchali (Nextron Systems), Thurein Oo (Yoma Bank)
date: 2020-02-22
modified: 2023-09-04
tags:
    - attack.initial-access
    - attack.t1190
logsource:
    category: webserver
detection:
    selection:
        cs-method: 'GET'
    keywords:
        - '@@version'
        - '%271%27%3D%271'
        - '=select '
        - '=select('
        - '=select%20'
        - 'concat_ws('
        - 'CONCAT(0x'
        - 'from mysql.innodb_table_stats'
        - 'from%20mysql.innodb_table_stats'
        - 'group_concat('
        - 'information_schema.tables'
        - 'json_arrayagg('
        - 'or 1=1#'
        - 'or%201=1#'
        - 'order by '
        - 'order%20by%20'
        - 'select * '
        - 'select database()'
        - 'select version()'
        - 'select%20*%20'
        - 'select%20database()'
        - 'select%20version()'
        - 'select%28sleep%2810%29'
        - 'SELECTCHAR('
        - 'table_schema'
        - 'UNION ALL SELECT'
        - 'UNION SELECT'
        - 'UNION%20ALL%20SELECT'
        - 'UNION%20SELECT'
        - "'1'='1"
    filter_main_status:
        sc-status: 404
    condition: selection and keywords and not 1 of filter_main_*
falsepositives:
    - Java scripts and CSS Files
    - User searches in search boxes of the respective website
    - Internal vulnerability scanners can cause some serious FPs when used, if you experience a lot of FPs due to this think of adding more filters such as "User Agent" strings and more response codes
level: high

Stages and Predicates

Stage 0: condition

selection and keywords and not 1 of filter_main_*

Stage 1: selection

selection:
    cs-method: 'GET'

Stage 2: keywords

keywords:
    - '@@version'
    - '%271%27%3D%271'
    - '=select '
    - '=select('
    - '=select%20'
    - 'concat_ws('
    - 'CONCAT(0x'
    - 'from mysql.innodb_table_stats'
    - 'from%20mysql.innodb_table_stats'
    - 'group_concat('
    - 'information_schema.tables'
    - 'json_arrayagg('
    - 'or 1=1#'
    - 'or%201=1#'
    - 'order by '
    - 'order%20by%20'
    - 'select * '
    - 'select database()'
    - 'select version()'
    - 'select%20*%20'
    - 'select%20database()'
    - 'select%20version()'
    - 'select%28sleep%2810%29'
    - 'SELECTCHAR('
    - 'table_schema'
    - 'UNION ALL SELECT'
    - 'UNION SELECT'
    - 'UNION%20ALL%20SELECT'
    - 'UNION%20SELECT'
    - "'1'='1"

Stage 3: not filter_main_status

filter_main_status:
    sc-status: 404

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
sc-statuseq404

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
cs-methodeq
  • GET