Linux: Flock Used to Launch an Interactive Shell

Flags Linux process creation where flock is invoked with a user option and common shell paths on the command line.

FreeUnreviewedSigmahighv1
title: "Linux: Flock Used to Launch an Interactive Shell"
id: 9c4680bc-ab1b-47f6-b237-f8a9109c2632
status: test
description: This rule identifies process executions of the flock utility where the command line includes user selection (" -u ") and references common shell binaries such as bash, dash, fish, sh, or zsh. Attackers may use flock to run or invoke a shell, supporting unauthorized command execution or escape from restricted execution environments. The detection relies on Linux process creation telemetry capturing the image path ending in /flock and the full command line contents.
references:
  - https://gtfobins.github.io/gtfobins/flock/#shell
  - https://www.elastic.co/guide/en/security/current/linux-restricted-shell-breakout-via-linux-binary-s.html
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_flock_shell_execution.yml
author: Li Ling, Andy Parkidomo, Robert Rakowski, Blake Hartstein (Bloomberg L.P.), Huntrule Team
date: 2024-09-02
tags:
  - attack.discovery
  - attack.t1083
logsource:
  category: process_creation
  product: linux
detection:
  selection_img:
    Image|endswith: /flock
    CommandLine|contains: " -u "
  selection_cli:
    CommandLine|contains:
      - /bin/bash
      - /bin/dash
      - /bin/fish
      - /bin/sh
      - /bin/zsh
  condition: all of selection_*
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: 4b09c71e-4269-4111-9cdd-107d8867f0cc
    type: derived

What it detects

This rule identifies process executions of the flock utility where the command line includes user selection (" -u ") and references common shell binaries such as bash, dash, fish, sh, or zsh. Attackers may use flock to run or invoke a shell, supporting unauthorized command execution or escape from restricted execution environments. The detection relies on Linux process creation telemetry capturing the image path ending in /flock and the full command line contents.

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.