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

Suspicious Commands

This note documents detection patterns related to suspicious command execution on Linux systems.


Direct Indicators

ArtifactString / SignalDetection UseForensic ValueNotes
bash historycurl httpPayload retrievalCriticalCommon staging
bash historywget httpRemote downloadCriticalPayload acquisition
bash historychmod +xExecution prepHighOften follows download
bash history./payloadLocal executionCriticalDirect payload run
bash historync -eReverse shellCriticalClassic shell launch
bash historybash -i >&Reverse shellCriticalCommon shell syntax
bash historypython -cInline payloadHighInterpreter abuse
bash historyperl -eInline payloadHighGTFOBIN pattern
bash historysocatTunnel or shellHighAdvanced operator usage
bash historybase64 -dPayload decodeHighObfuscation step

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Download followed by executecurl/wget then chmod/runCriticalClassic intrusion flow
Encoded commandsbase64 / hex decodeHighObfuscation
Interpreter chainpython → bash → ncCriticalMulti-stage payload
Temporary path execution/tmp, /dev/shmCriticalAdversary staging
Rare admin commands at odd timesUnexpected root actionsHighSuspicious operator behavior

Common Tools

ToolUsage
curlPayload retrieval
wgetRemote fetch
ncReverse shell
socatTunnel / shell
pythonInline execution
perlInline execution
bashReverse shell
opensslEncoded payload handling

Relevant Artifacts

  • /home/*/.bash_history
  • /root/.bash_history
  • /var/log/auth.log
  • journalctl
  • /tmp
  • /dev/shm
  • shell startup files
  • downloaded payload files

MITRE ATT&CK References

  • T1059 Command and Scripting Interpreter
  • T1105 Ingress Tool Transfer
  • T1059.004 Unix Shell

Decision Tree

  1. Was a suspicious command executed?
    • Review shell history.
  2. Did it fetch external content?
    • Confirm network source.
  3. Did execution follow?
    • Identify chmod / interpreter use.
  4. Pivot:
    • downloaded file
    • temp path
    • outbound connection
  5. Confirm malicious chain
    • reconstruct command sequence.

Example Detection Templates

Grep

grep -Ei "curl |wget |chmod \+x|nc -e|bash -i|python -c|perl -e|base64 -d|socat" /home/*/.bash_history /root/.bash_history 2>/dev/null

Journalctl

journalctl | grep -Ei "curl|wget|python|perl|bash|nc|socat"

Auth Correlation

grep "Accepted" /var/log/auth.log

Temp Execution

find /tmp /dev/shm -type f -executable 2>/dev/null

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
AuditdCapture command executionCriticalIndependent evidence
Restrict outbound fetch toolsLimit curl/wget on serversHighReduces abuse
Temp execution controlsMount noexec where possibleHighBlocks staging
Central loggingPreserve shell evidenceCriticalSupports timeline
AlertingDetect suspicious command stringsHighFast triage