info_macho_control_flow

YARA-2023-0210 Low general Active

Identify macho's that have irregular control flow with initializers or terminators using the macho-module

info_macho_control_flow.yar Valid Syntax
import "macho"

rule info_macho_control_flow
{
	meta:
		description = "Identify macho's that have irregular control flow with initializers or terminators using the macho-module"
		author = "@shellcromancer"
		version = "1.0"
		date = "2023.01.27"
		sample = "af7c395426649c57e44eac0bb6c6a109ac649763065ff5b2b23db71839bac655"
		reference = "https://github.com/aidansteele/osx-abi-macho-file-format-reference#table-2-the-sections-of-a__datasegment"
		reference = "https://twitter.com/greglesnewich/status/1618758795743866881"
		DaysofYARA = "27/100"

	condition:
		for any seg in macho.segments : (
			seg.segname == "__DATA" and
			for any sect in seg.sections : (
				(
					sect.sectname == "__mod_init_func" or
					sect.sectname == "__mod_term_func"
				)
			)
		)
}

Rule Metadata

description
Identify macho's that have irregular control flow with initializers or terminators using the macho-module
author
@shellcromancer
version
1.0
date
2023.01.27
sample
af7c395426649c57e44eac0bb6c6a109ac649763065ff5b2b23db71839bac655
reference
https://twitter.com/greglesnewich/status/1618758795743866881
DaysofYARA
27/100

Threat Analysis

This YARA rule is designed to detect general threats.

Severity Level: Low

The rule uses pattern matching to identify specific byte sequences, strings, or behavioral patterns associated with malicious activity.

Detection Capabilities

  • File-based detection for executables and documents
  • Memory scanning for running processes
  • Network traffic analysis support

Command Line Usage

# Scan a single file
yara info_macho_control_flow.yar /path/to/suspicious/file

# Scan a directory recursively
yara -r info_macho_control_flow.yar /path/to/directory/

# Scan with metadata output
yara -m info_macho_control_flow.yar target_file

# Scan process memory (Linux)
yara info_macho_control_flow.yar /proc/[pid]/exe

Integration Examples

Python (yara-python)

import yara
rules = yara.compile(filepath='info_macho_control_flow.yar')
matches = rules.match('/path/to/file')

ClamAV Integration

clamscan --yara-rules=info_macho_control_flow.yar /path/to/scan

Rule Information

YARA ID
YARA-2023-0210
Created
August 19, 2025
Last Updated
August 19, 2025
Last Imported
Never

Threat Intelligence

Risk Level Low
Category general
Detection Confidence Analysis Pending
False Positive Rate Not Available
Last Seen in Wild No Data

Export Options