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

Authorized Keys Backdoor

This note documents detection patterns related to Authorized Keys Backdoor on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
SSH artifactnew entry in authorized_keysSSH persistenceCriticalMost common Linux persistence path.
Shell historyecho ssh-rsa >> authorized_keysManual key insertionCriticalDirect attacker action.
Shell historycat key.pub >> authorized_keysPublic key appendCriticalStrong persistence evidence.
Shell historymkdir -p ~/.sshSSH path creationHighOften precedes backdoor insertion.
Shell historychmod 600 authorized_keysPermission normalizationHighCommon post-insertion step.
File timestampsrecent authorized_keys modificationTimeline anchorCriticalHigh-value forensic truth.
Multiple unknown keysunauthorized persistenceCriticalImmediate anomaly.
Root key insertionprivileged persistenceCriticalHighest severity.
Service account key insertionstealth persistenceCriticalOften overlooked foothold.
auditdwrite to .ssh/authorized_keysProcess attributionCriticalBest attribution if enabled.
Journaldssh login with new keyRuntime proofCriticalConfirms operational use.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Key inserted after sudo/root shellPersistence after escalationCriticalStrong hostile sequence.
Hidden .ssh path created suddenlyNew persistence locationCriticalStrong anomaly.
Same key across many hostsLateral persistenceCriticalStrong campaign signal.
Dormant account gains keySilent persistenceCriticalCommon attacker behavior.
Key added then history clearedCleanup disciplineHighMature operator clue.

Common Tools

ToolUsage
echoDirect key append.
catAppend public key.
chmodFix SSH permissions.
ssh-copy-idLegit / attacker-assisted insertion.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Authorized keys~/.ssh/authorized_keysCriticalPrimary artifact.
SSH dir~/.ssh/CriticalSupporting context.
File timestampsstat authorized_keysCriticalTimeline truth.
Shell history.bash_historyCriticalInsert command evidence.
Audit logs/var/log/audit/audit.logCriticalAttribution.

MITRE ATT&CK References

  • T1098 Account Manipulation
  • T1098.004 SSH Authorized Keys

Decision Tree

  1. Was key added?
  2. Which account?
  3. When modified?
  4. Was key used afterward?
  5. Same key elsewhere?

Example Detection Templates

Grep

grep -R "authorized_keys\|ssh-rsa\|ssh-ed25519" /home/*/.bash_history /root/.bash_history 2>/dev/null

Journalctl

journalctl | grep ssh

File Inspection

find /home /root -name authorized_keys -exec stat {} \; 2>/dev/null

Sigma

title: Linux Authorized Keys Backdoor
id: linux-authorized-keys-backdoor
status: experimental
description: Detects suspicious SSH authorized_keys modification
logsource:
  product: linux
detection:
  selection_keywords:
    message|contains:
      - 'authorized_keys'
      - 'ssh-rsa'
  condition: selection_keywords
level: high
tags:
  - attack.persistence
  - attack.t1098.004

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Key reviewBaseline authorized keysCriticalDetects rogue entries.
AuditdTrack writes to .sshHighStrong attribution.
MFAReduce key-only persistence impactHighLimits stealth login.