Skip to content

YARA · Signature Base (Florian Roth / Nextron)

SIGNATURE_BASE_EXPL_Gitlab_CE_RCE_Malformed_JPG_CVE_2021_22204

Detects malformed JPG files exploting EXIF vulnerability CVE-2021-22204 and used in the exploitation of GitLab vulnerability CVE-2021-22205

ExploitSignature Base (Florian Roth / Nextron)Detection Rule License 1.1Compiles with YARA-X (with warnings)
Author
Florian Roth (Nextron Systems)
Date
2021-10-26
Modified
2023-12-05
Score / Quality
70 / 83

What this rule detects

Detects malformed JPG files exploting EXIF vulnerability CVE-2021-22204 and used in the exploitation of GitLab vulnerability CVE-2021-22205

It defines 2 patterns (0 text, 1 hex, 1 regex).

YARA-X says: warning[text_as_hex]: hex pattern could be written as text literal

Summary generated from the rule's metadata and condition.

Rule source

expl-gitlab-ce-rce-malformed-jpg-cve-2021-22204.yarDetection Rule License 1.1
rule SIGNATURE_BASE_EXPL_Gitlab_CE_RCE_Malformed_JPG_CVE_2021_22204 : CVE_2021_22204 CVE_2021_22205 FILE
{
	meta:
		description = "Detects malformed JPG files exploting EXIF vulnerability CVE-2021-22204 and used in the exploitation of GitLab vulnerability CVE-2021-22205"
		author = "Florian Roth (Nextron Systems)"
		id = "3d769340-0306-596d-8783-2b37b93a5673"
		date = "2021-10-26"
		modified = "2023-12-05"
		reference = "https://attackerkb.com/topics/D41jRUXCiJ/cve-2021-22205/rapid7-analysis?referrer=blog"
		source_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/exploit_gitlab_cve_2021_22205.yar#L29-L44"
		license_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
		logic_hash = "0718ad24337acbb746c6e0d7e0b42d2d034ff583ec6fd12b34fda4737d7e78b0"
		score = 70
		quality = 83
		tags = "CVE-2021-22204, CVE-2021-22205, FILE"

	strings:
		$h1 = { 41 54 26 54 46 4F 52 4D }
		$sr1 = /\(metadata[\s]{0,3}\([A-Za-z]{1,20} "\\/

	condition:
		filesize < 10KB and $h1 and $sr1
}

Strings (2 patterns)

IdentifierTypeValueModifiers
$h1hex{ 41 54 26 54 46 4F 52 4D }
$sr1regex/\(metadata[\s]{0,3}\([A-Za-z]{1,20} "\\/

Condition

filesize < 10KB and $h1 and $sr1

In plain words (Heuristic)

  • The file must be smaller than 10KB (a cheap guard that skips large files).
  • Pattern $h1 must be present.
  • Pattern $sr1 must be present.

Test this rule in your browser

Drop a file to scan it with this rule using YARA-X compiled to WebAssembly. Nothing is uploaded.

Drop a file here or click to chooseScanned locally with YARA-X. Files up to 200 MB.

Open in editor

References

Licence & attribution

Author: Florian Roth (Nextron Systems)

Source repository: Signature Base (Florian Roth / Nextron) @ 94a1c48d7a

Licence: Detection Rule License 1.1 (repository licence)

Original rule

Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.

Rule id: 3d769340-0306-596d-8783-2b37b93a5673

Tags:CVE_2021_22204CVE_2021_22205FILE