title: Suspicious Use of /dev/tcp
id: 6cc5fceb-9a71-4c23-aeeb-963abe0b279c
status: experimental
description: Detects suspicious command with /dev/tcp
author: frack113
references:
  - https://www.andreafortuna.org/2021/03/06/some-useful-tips-about-dev-tcp/
  - https://book.hacktricks.xyz/shells/shells/linux
  - https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1046/T1046.md#atomic-test-1---port-scan
date: 2021/12/10
modified: 2022/01/10
logsource:
  product: linux
detection:
  keyword:
    - 'cat </dev/tcp/'
    - 'exec 3<>/dev/tcp/'
    - 'echo >/dev/tcp/'
    - 'bash -i >& /dev/tcp/'
    - 'sh -i >& /dev/udp/'
    - '0<&196;exec 196<>/dev/tcp/'
    - 'exec 5<>/dev/tcp/'
    - '(sh)0>/dev/tcp/'
    - 'bash -c ''bash -i >& /dev/tcp/'
    - 'echo -e ''#!/bin/bash\nbash -i >& /dev/tcp/'
  condition: 1 of keyword
falsepositives:
  - Unknown
level: medium
tags:
  - attack.reconnaissance
