Linux wget writes files to /tmp or /var/tmp

Alerts when wget creates files under /tmp or /var/tmp on Linux.

FreeUnreviewedSigmamediumv1
title: Linux wget writes files to /tmp or /var/tmp
id: 62bdd924-57ad-4c80-808d-ec7c60981208
status: test
description: This rule flags file creation events where the process executable is wget and the target filename is located under /tmp/ or /var/tmp/. Attackers commonly stage downloaded content in temporary directories to avoid obvious persistence and to prepare follow-on execution steps. It relies on Linux file event telemetry capturing the process path and the created file’s target location.
references:
  - https://blogs.jpcert.or.jp/en/2023/05/gobrat.html
  - https://jstnk9.github.io/jstnk9/research/GobRAT-Malware/
  - https://www.virustotal.com/gui/file/60bcd645450e4c846238cf0e7226dc40c84c96eba99f6b2cffcd0ab4a391c8b3/detection
  - https://www.virustotal.com/gui/file/3e44c807a25a56f4068b5b8186eee5002eed6f26d665a8b791c472ad154585d1/detection
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/file_event/file_event_lnx_wget_download_file_in_tmp_dir.yml
author: Joseliyo Sanchez, @Joseliyo_Jstnk, Huntrule Team
date: 2023-06-02
tags:
  - attack.command-and-control
  - attack.t1105
logsource:
  product: linux
  category: file_event
detection:
  selection:
    Image|endswith: /wget
    TargetFilename|startswith:
      - /tmp/
      - /var/tmp/
  condition: selection
falsepositives:
  - Legitimate downloads of files in the tmp folder.
level: medium
license: DRL-1.1
related:
  - id: 35a05c60-9012-49b6-a11f-6bab741c9f74
    type: derived

What it detects

This rule flags file creation events where the process executable is wget and the target filename is located under /tmp/ or /var/tmp/. Attackers commonly stage downloaded content in temporary directories to avoid obvious persistence and to prepare follow-on execution steps. It relies on Linux file event telemetry capturing the process path and the created file’s target location.

Known false positives

  • Legitimate downloads of files in the tmp folder.

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