Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Tool_Gsocket_Strings

Detects Gsocket based on strings

Hack toolSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X
Author
Sekoia.io
Date
2024-06-10
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detects Gsocket based on strings

Targets: Windows PE, Linux ELF, macOS Mach-O.

It defines 6 patterns (6 text, 0 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

tool-gsocket-strings.yarDetection Rule License 1.1
rule SEKOIA_Tool_Gsocket_Strings : FILE
{
	meta:
		description = "Detects Gsocket based on strings"
		author = "Sekoia.io"
		id = "55fb2f2b-1074-4b6d-9113-48eaeb0e1e27"
		date = "2024-06-10"
		modified = "2024-12-19"
		reference = "https://github.com/SEKOIA-IO/Community"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/tool_gsocket_strings.yar#L1-L28"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		logic_hash = "c54308293a9f64b571282eac9fba01e4671ba6b0cd45936fab92d4d9af904bbb"
		score = 75
		quality = 80
		tags = "FILE"
		version = "1.0"
		classification = "TLP:CLEAR"

	strings:
		$ = "proxy. It allows multiple gs-netcat clients to (securely) relay"
		$ = "GS-NETCAT(1)            General Commands Manual          GS-NETCAT(1)"
		$ = "-T      Use TOR. The gs-netcat tool will connect via TOR to the GSRN."
		$ = "-D      Daemon & Watchdog mode. Start gs-netcat as a background process"
		$ = "gs-netcat [-rlgvqwCTSDiu] [-s secret] [-k keyfile] [-L logfile] [-d IP]"
		$ = "The gs-netcat utility is a re-implementation of netcat."

	condition:
		( uint32be( 0 ) == 0x7f454c46 or uint16be( 0 ) == 0x4d5a or uint32be( 0 ) == 0xfeedface or uint32be( 0 ) == 0xcffaedfe or uint32be( 0 ) == 0xcafebabe ) and filesize > 2MB and filesize < 6MB and 2 of them
}

Strings (6 patterns)

IdentifierTypeValueModifiers
$text"proxy. It allows multiple gs-netcat clients to (securely) relay"
$text"GS-NETCAT(1) General Commands Manual GS-NETCAT(1)"
$text"-T Use TOR. The gs-netcat tool will connect via TOR to the GSRN."
$text"-D Daemon & Watchdog mode. Start gs-netcat as a background process"
$text"gs-netcat [-rlgvqwCTSDiu] [-s secret] [-k keyfile] [-L logfile] [-d IP]"
$text"The gs-netcat utility is a re-implementation of netcat."

Condition

( uint32be( 0 ) == 0x7f454c46 or uint16be( 0 ) == 0x4d5a or uint32be( 0 ) == 0xfeedface or uint32be( 0 ) == 0xcffaedfe or uint32be( 0 ) == 0xcafebabe ) and filesize > 2MB and filesize < 6MB and 2 of them

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • The file must start with the ELF header — a Linux/Unix executable.
  • The file must start with a Mach-O / fat binary magic — a macOS executable.
  • The file must be smaller than 6MB (a cheap guard that skips large files).
  • The file must be larger than 2MB.
  • At least 2 patterns in the rule must match.

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: Sekoia.io

Source repository: SEKOIA.IO Community @ a438a5901a

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: 55fb2f2b-1074-4b6d-9113-48eaeb0e1e27

Metadata

version1.0
classificationTLP:CLEAR

Tags:FILE