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

Suspicious Tmp Payloads

This note documents detection patterns related to Suspicious Tmp Payloads on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
/tmpNewly created executable fileTemporary payload stagedCriticalVery common attacker location.
/var/tmpExecutable binary or scriptPersistent temp stagingCriticalSurvives reboot unlike /tmp.
/dev/shmExecutable fileMemory-backed stealth payloadCriticalHigh stealth value.
File modeexecutable bit setPayload prepared for executionCriticalStrong malicious indicator when recent.
File namehidden or service-like nameCamouflageHighCommon names: .sys, .cache, dbus-update.
File typeELF binary in tempNative payloadCriticalStrong execution artifact.
File typeshell / python / perl scriptScript payloadCriticalCommon quick-stage payload.
Shell historyexecute temp filePayload launchedCriticalStrong operator evidence.
Shell historychmod +x /tmp/...Execution prepCriticalClassic staging step.
auditdexecve from temp pathProcess truthCriticalBest attribution if enabled.
journalctlprocess from temp pathRuntime clueHighDepends on host logging.
Network telemetrytemp process opens socketActive payloadCriticalStrong compromise signal.
File timestampsrecent temp creationTimeline anchorCriticalCorrelates with intrusion window.
Deleted temp inode remnantspayload removed after useHighIndicates cleanup attempt.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Temp payload after SSH loginManual stagingCriticalCommon attacker progression.
Temp payload after downloaderStage-to-execute chainCriticalStrong intrusion sequence.
Temp payload plus cron/servicePersistence linkCriticalPayload operationalized.
Hidden dotfile in tempBasic stealthHighFrequently overlooked.
Temp binary with root ownerPrivileged executionCriticalHigh severity.
Temp script references external IPCallback logicCriticalStrong malicious signal.
Temp file plus deleted shell historyCleanup behaviorHighOperator discipline clue.
Temp payload reappears repeatedlyRe-staging or cron re-fetchHighDurability pattern.
Temp file name mimics daemonCamouflageHighCommon stealth pattern.
Temp payload launched by service accountExploitation chainCriticalOften web compromise signal.

Common Tools

ToolUsage
chmod +xMake payload executable.
./payloadDirect local execution.
nohupBackground temp payload.
setsidDetached execution.
mvRename payload to stealthier name.
rmCleanup after execution.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Temp directory/tmpCriticalPrimary staging zone.
Persistent temp/var/tmpCriticalCommon persistence-friendly staging.
Shared memory/dev/shmCriticalHigh stealth zone.
File metadatastatCriticalTimeline truth.
File typefile <payload>CriticalBinary/script classification.
Stringsstrings <payload>HighInfra clues.
Shell history.bash_history, .zsh_historyCriticalLaunch evidence.
Audit logs/var/log/audit/audit.logCriticalExec attribution.
Process treeps auxfCriticalLive execution context.

MITRE ATT&CK References

  • T1105 Ingress Tool Transfer
  • T1036 Masquerading
  • T1059 Command and Scripting Interpreter

Decision Tree

  1. Are temp files suspicious?

    • Enumerate executables and recent files.
  2. Which path hosts payload?

    • /tmp, /var/tmp, /dev/shm.
  3. Was payload executed?

    • Shell history, auditd, process traces.
  4. Does payload connect outward?

    • Network sockets, strings, config.
  5. Is persistence linked?

    • Cron, services, startup files.
  6. Pivot

    • File → strings/hash.
    • Timestamp → intrusion timeline.
    • Owner → privilege context.
  7. Confirm payload

    • Recent executable temp file + execution evidence = strong malicious staging.

Example Detection Templates

Grep

find /tmp /var/tmp /dev/shm -type f -perm /111 2>/dev/null
find /tmp /var/tmp /dev/shm -type f -name ".*" 2>/dev/null
grep -R "/tmp/\|/var/tmp/\|/dev/shm/" /home/*/.bash_history /root/.bash_history 2>/dev/null

Journalctl

journalctl | grep -E "/tmp|/var/tmp|/dev/shm"

File Inspection

find /tmp /var/tmp /dev/shm -type f -printf '%TY-%Tm-%Td %TT %p\n' 2>/dev/null | sort
file /tmp/* /var/tmp/* /dev/shm/* 2>/dev/null

Sigma

title: Linux Suspicious Temp Payloads
id: linux-suspicious-temp-payloads
status: experimental
description: Detects suspicious executable payloads staged in temporary Linux directories
logsource:
  product: linux
detection:
  selection_keywords:
    message|contains:
      - '/tmp'
      - '/var/tmp'
      - '/dev/shm'
  condition: selection_keywords
fields:
  - message
  - hostname
falsepositives:
  - Legitimate installer temp artifacts
level: high
tags:
  - attack.execution
  - attack.t1105

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Temp execution controlMount temp dirs noexec where possibleCriticalMajor reduction in payload utility.
File monitoringWatch temp dirs for executablesCriticalStrong invariant detection.
AuditdTrack execve from temp pathsHighStrong attribution.
Least privilegeRestrict service account temp executionHighLimits exploitation paths.
Cleanup policyPreserve suspicious temp artifacts before cleanupHighImportant forensic retention.

Fast Triage Checks

QuestionCommand / ArtifactWhy It Matters
Any executable temp files?find temp executablesImmediate payload check.
Which file is newest?sort timestampsTimeline anchor.
Is payload hidden?inspect dotfilesStealth clue.
Was payload launched?shell history / auditdExecution proof.
Does payload connect out?strings / socketsC2 clue.
Is persistence linked?inspect cron/servicesOperationalization.

High Value Grep Strings

PatternWhy It Matters
/tmp/Primary staging path.
/var/tmp/Persistent temp path.
/dev/shm/Memory-backed stealth path.
chmod +xExecution prep.
nohupDetached execution.
setsidDetached execution.
rm /tmp/Cleanup clue.

Analyst Notes

ScenarioInterpretation
ELF in /dev/shmHigh stealth operator staging.
Hidden dotfile in tempSimple camouflage.
Temp payload plus callbackStrong active compromise.
Temp file deleted quicklyCleanup attempt likely.
Temp payload owned by rootPrivileged execution path.
Temp payload plus cronPersistence operationalized.