Suspicious Use of /dev/tcp (via linux)

This rule detects anomalous command with /dev/tcp

SigmamediumLinuxv1
sigma
title: Suspicious Use of /dev/tcp (via linux)
id: 72939787-a9ac-57a3-903f-d9ea0c2d9781
status: stable
description: This rule detects anomalous command with /dev/tcp
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/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1046/T1046.md#atomic-test-1---port-scan
author: Huntrule Team
date: 2026-06-28
tags:
    - attack.reconnaissance
    - attack.execution
    - attack.t1059.004
logsource:
    product: linux
detection:
    keywords:
        - '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: keywords
falsepositives:
    - Unknown
level: medium

Known false positives

  • Unknown

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.