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

Outbound Connections

This note documents detection patterns related to Suspicious Outbound Connections on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
Shell historync Netcat outbound connectionCriticalCommon reverse shell and exfil primitive.
Shell historybash -i >& /dev/tcp/Native bash reverse shellCriticalHigh-confidence malicious outbound execution.
Shell historycurl http://Direct outbound retrieval / callbackHighContext determines maliciousness.
Shell historywget http://Outbound retrievalHighOften staging precursor.
Shell historypython -c socketScripted socket callbackCriticalCommon custom reverse shell.
Shell historyopenssl s_clientEncrypted outbound tunnelHighSometimes used for stealth shells.
Shell historysocat TCP:Advanced socket pivotCriticalStrong operator indicator.
Process listunknown process with ESTABLISHED connectionActive beacon/payloadCriticalRuntime truth.
ss -plant / netstat -plantoutbound unusual remote IPActive network compromiseCriticalImmediate live evidence.
lsof -iPID owning suspicious socketAttributionCriticalConnect process to artifact.
auditdexecve before outbound socketProcess truthCriticalStrong attribution.
journalctlservice opening external connectionRuntime clueHighService-linked callbacks.
Firewall logsoutbound uncommon destinationNetwork proofCriticalEspecially rare countries / infra.
DNS logssuspicious domain lookupPre-connection clueHighOften precedes callback.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Outbound connection after temp payloadActive payload executionCriticalStrong stage-to-callback chain.
Outbound immediately after loginManual operator callbackCriticalCommon foothold progression.
Repeated short interval callbacksBeaconingCriticalStrong C2 pattern.
Outbound from service accountSuspicious contextCriticalOften exploitation path.
Connection to raw IPOperator infraHighOften suspicious.
TLS without expected processHidden encrypted tunnelHighProcess attribution critical.
Same IP contacted by multiple payloadsCentral operator infraCriticalCampaign clue.
Outbound plus cron/servicePersistent beaconCriticalOperationalized persistence.
Hidden binary owns socketConcealed payload activeCriticalStrong malicious signal.
Deleted payload but socket persistsRunning deleted processCriticalHigh-value live clue.

Common Tools

ToolUsage
ncReverse shell / exfiltration.
bash /dev/tcpNative reverse shell.
curlCallback or exfil channel.
wgetRetrieval and callbacks.
python socketScripted network shell.
socatAdvanced pivoting / tunnels.
openssl s_clientEncrypted channel.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Live socketsss -plant, netstat -plantCriticalImmediate runtime truth.
Process attributionlsof -iCriticalMaps PID to socket.
Shell history.bash_history, .zsh_historyCriticalLaunch evidence.
Audit logs/var/log/audit/audit.logCriticalProcess attribution.
Firewall logsnftables / iptables / EDRCriticalNetwork truth.
DNS logsresolver / cache logsHighDomain clue.
Payload pathstemp / hidden filesCriticalOwning executable.

MITRE ATT&CK References

  • T1071 Application Layer Protocol
  • T1105 Ingress Tool Transfer
  • T1041 Exfiltration Over C2 Channel

Decision Tree

  1. Is outbound connection active?

    • Enumerate sockets and owning processes.
  2. Which process owns it?

    • PID, path, user, parent.
  3. Is destination expected?

    • IP, domain, port, geography.
  4. Is command history aligned?

    • Reverse shell / downloader / tunnel.
  5. Is persistence linked?

    • Cron, services, startup, hidden payloads.
  6. Pivot

    • Process → file path.
    • IP/domain → timeline.
    • User → access context.
  7. Confirm malicious outbound

    • Suspicious process + unknown remote endpoint + intrusion context = strong callback finding.

Example Detection Templates

Grep

grep -R "nc \|/dev/tcp/\|python -c.*socket\|socat TCP:\|openssl s_client" /home/*/.bash_history /root/.bash_history 2>/dev/null
grep -R "curl http\|wget http" /home/*/.bash_history /root/.bash_history 2>/dev/null

Journalctl

journalctl | grep -E "connect|socket|network"

File Inspection

ss -plant
lsof -i

Sigma

title: Linux Suspicious Outbound Connections
id: linux-suspicious-outbound-connections
status: experimental
description: Detects suspicious outbound connection behavior associated with payloads or reverse shells
logsource:
  product: linux
detection:
  selection_keywords:
    message|contains:
      - 'nc '
      - '/dev/tcp/'
      - 'socat'
      - 'openssl s_client'
  condition: selection_keywords
fields:
  - message
  - hostname
falsepositives:
  - Legitimate troubleshooting or admin tunneling
level: high
tags:
  - attack.command_and_control
  - attack.t1071

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Egress filteringRestrict arbitrary outbound trafficCriticalMajor callback reduction.
Process monitoringAlert on unusual socket ownersCriticalStrong runtime detection.
AuditdTrack execve before network actionsHighAttribution layer.
DNS monitoringWatch unusual domainsHighEarly signal.
Temp execution controlReduce payload callback optionsHighIndirect prevention.

Fast Triage Checks

QuestionCommand / ArtifactWhy It Matters
Any suspicious ESTABLISHED sockets?ss / lsofImmediate runtime proof.
Which process owns socket?PID attributionCore truth.
Is remote IP expected?destination reviewSuspicion scoring.
Was shell command used?grep historyLaunch evidence.
Is payload hidden/temp?inspect process pathStealth clue.
Is persistence linked?cron/service reviewOperationalization.

High Value Grep Strings

PatternWhy It Matters
nc Netcat shell or exfil.
/dev/tcp/Native bash callback.
python -cScripted socket shell.
socat TCP:Advanced pivot.
openssl s_clientEncrypted tunnel.
curl httpCallback or staging.
wget httpCallback or staging.

Analyst Notes

ScenarioInterpretation
Temp payload owns ESTABLISHED socketStrong active compromise.
Hidden file owns socketConcealed beacon likely.
Repeated outbound every minuteBeaconing pattern.
Socket survives deleted fileRunning deleted payload.
Service account outbound TLSSuspicious unless expected.
Netcat + external IPVery strong operator evidence.