Detection rules › Sigma

Server Side Template Injection Strings

Status
test
Severity
high
Log source
category webserver
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects SSTI attempts sent via GET requests in access logs

MITRE ATT&CK coverage

TacticTechniques
StealthT1221 Template Injection

Rule body yaml

title: Server Side Template Injection Strings
id: ada3bc4f-f0fd-42b9-ba91-e105e8af7342
status: test
description: Detects SSTI attempts sent via GET requests in access logs
references:
    - https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection
    - https://github.com/payloadbox/ssti-payloads
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-06-14
tags:
    - attack.stealth
    - attack.t1221
logsource:
    category: webserver
detection:
    select_method:
        cs-method: 'GET'
    keywords:
        - '={{'
        - '=%7B%7B'
        - '=${'
        - '=$%7B'
        - '=<%='
        - '=%3C%25='
        - '=@('
        - 'freemarker.template.utility.Execute'
        - .getClass().forName('javax.script.ScriptEngineManager')
        - 'T(org.apache.commons.io.IOUtils)'
    filter:
        sc-status: 404
    condition: select_method and keywords and not filter
falsepositives:
    - 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

select_method and keywords and not filter

Stage 1: select_method

select_method:
    cs-method: 'GET'

Stage 2: keywords

keywords:
    - '={{'
    - '=%7B%7B'
    - '=${'
    - '=$%7B'
    - '=<%='
    - '=%3C%25='
    - '=@('
    - 'freemarker.template.utility.Execute'
    - .getClass().forName('javax.script.ScriptEngineManager')
    - 'T(org.apache.commons.io.IOUtils)'

Stage 3: not filter

filter:
    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