Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / LINUX / EXECUTION

Interpreter Abuse

This note documents detection patterns related to Interpreter Abuse on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
Shell historypython -cInline code executionCriticalVery common payload launcher.
Shell historypython3 -cInline Python executionCriticalCommon reverse shell pattern.
Shell historyperl -eInline Perl payloadCriticalGTFOBins-style execution.
Shell historyruby -eInline Ruby payloadHighLess common but powerful.
Shell historyawk 'BEGINInline awk executionCriticalStrong GTFOBins indicator.
Shell historyphp -rInline PHP executionCriticalWeb/server abuse pattern.
Shell historybash -cWrapped inline executionCriticalCommon launcher wrapper.
Shell historysh -cMinimal inline executionHighOften nested in payloads.
Shell history/dev/tcp/Reverse shell through interpreterCriticalStrong malicious signal.
Shell historybase64 decode piped to interpreterObfuscated executionCriticalMature operator pattern.
auditdinterpreter spawnProcess attributionCriticalBest attribution if enabled.
Temp scriptless executionno file artifactCriticalMemory-light tradecraft.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Interpreter use immediately after footholdPayload stageCriticalStrong intrusion sequence.
Base64 then interpreterObfuscated executionCriticalMature operator signal.
Interpreter under service accountSuspicious contextCriticalOften exploitation shell.
Reverse shell via Python/PerlActive C2CriticalVery high severity.
No script file but interpreter activityFileless executionCriticalStrong stealth clue.

Common Tools

ToolUsage
PythonInline payload execution.
PerlGTFOBins execution.
RubyInline code.
AwkLightweight code execution.
PHPServer-side payloads.
BashWrapper execution.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Shell history.bash_historyCriticalPrimary evidence.
Audit logs/var/log/audit/audit.logCriticalProcess attribution.
Process treeps auxfCriticalParent-child linkage.
Temp dirs/tmp, /dev/shmHighRelated staging often nearby.

MITRE ATT&CK References

  • T1059 Command and Scripting Interpreter
  • T1059.006 Python
  • T1059.004 Unix Shell

Decision Tree

  1. Which interpreter used?
  2. Inline code or wrapper?
  3. Obfuscated?
  4. Reverse shell or payload?
  5. Which user context?

Example Detection Templates

Grep

grep -R "python -c\|python3 -c\|perl -e\|ruby -e\|awk 'BEGIN\|php -r\|bash -c\|sh -c\|/dev/tcp/" /home/*/.bash_history /root/.bash_history 2>/dev/null

Journalctl

journalctl | grep -E "python|perl|ruby|php|bash"

File Inspection

ps auxf | grep -E "python|perl|ruby|php"

Sigma

title: Linux Interpreter Abuse
id: linux-interpreter-abuse
status: experimental
description: Detects suspicious inline interpreter execution
logsource:
  product: linux
detection:
  selection_keywords:
    message|contains:
      - 'python -c'
      - 'perl -e'
      - 'php -r'
      - '/dev/tcp/'
  condition: selection_keywords
level: high
tags:
  - attack.execution
  - attack.t1059

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
AuditdTrack interpreter executionHighStrong attribution.
Restrict interpretersRemove unused runtimesHighShrinks abuse surface.
Egress controlBlock callback pathsCriticalReduces shell success.