Skip to content

YARA · Signature Base (Florian Roth / Nextron)

SIGNATURE_BASE_WEBSHELL_PHP_Function_Via_Get

Webshell which sends eval/assert via GET

WebshellSignature Base (Florian Roth / Nextron)Detection Rule License 1.1Compiles with YARA-X
Author
Arnim Rupp (https://github.com/ruppde)
Date
2021-01-09
Modified
2023-04-05
Score / Quality
75 / 83

What this rule detects

Webshell which sends eval/assert via GET

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

Summary generated from the rule's metadata and condition.

Rule source

webshell-php-function-via-get.yarDetection Rule License 1.1
rule SIGNATURE_BASE_WEBSHELL_PHP_Function_Via_Get : FILE
{
	meta:
		description = "Webshell which sends eval/assert via GET"
		author = "Arnim Rupp (https://github.com/ruppde)"
		id = "5fef1063-2f9f-516e-86f6-cfd98bb05e6e"
		date = "2021-01-09"
		modified = "2023-04-05"
		reference = "Internal Research"
		source_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/gen_webshells.yar#L2780-L2824"
		license_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
		hash = "ce739d65c31b3c7ea94357a38f7bd0dc264da052d4fd93a1eabb257f6e3a97a6"
		hash = "d870e971511ea3e082662f8e6ec22e8a8443ca79"
		hash = "73fa97372b3bb829835270a5e20259163ecc3fdbf73ef2a99cb80709ea4572be"
		logic_hash = "309203db8e7374531d359e3a723418d47bead45034c4a7bd726fb714622dc039"
		score = 75
		quality = 83
		tags = "FILE"
		license = "Detection Rule License 1.1 https://github.com/Neo23x0/signature-base/blob/master/LICENSE"
		importance = 70

	strings:
		$sr0 = /\$_GET\s?\[.{1,30}\]\(\$_GET\s?\[/ wide ascii
		$sr1 = /\$_POST\s?\[.{1,30}\]\(\$_GET\s?\[/ wide ascii
		$sr2 = /\$_POST\s?\[.{1,30}\]\(\$_POST\s?\[/ wide ascii
		$sr3 = /\$_GET\s?\[.{1,30}\]\(\$_POST\s?\[/ wide ascii
		$sr4 = /\$_REQUEST\s?\[.{1,30}\]\(\$_REQUEST\s?\[/ wide ascii
		$sr5 = /\$_SERVER\s?\[HTTP_.{1,30}\]\(\$_SERVER\s?\[HTTP_/ wide ascii
		$gfp1 = "eval(\"return [$serialised_parameter"
		$gfp2 = "$this->assert(strpos($styles, $"
		$gfp3 = "$module = new $_GET['module']($_GET['scope']);"
		$gfp4 = "$plugin->$_POST['action']($_POST['id']);"
		$gfp5 = "$_POST[partition_by]($_POST["
		$gfp6 = "$object = new $_REQUEST['type']($_REQUEST['id']);"
		$gfp7 = "The above example code can be easily exploited by passing in a string such as"
		$gfp8 = "Smarty_Internal_Debug::start_render($_template);"
		$gfp9 = "?p4yl04d=UNION%20SELECT%20'<?%20system($_GET['command']);%20?>',2,3%20INTO%20OUTFILE%20'/var/www/w3bsh3ll.php"
		$gfp10 = "[][}{;|]\\|\\\\[+=]\\|<?=>?"
		$gfp11 = "(eval (getenv \"EPROLOG\")))"
		$gfp12 = "ZmlsZV9nZXRfY29udGVudHMoJ2h0dHA6Ly9saWNlbnNlLm9wZW5jYXJ0LWFwaS5jb20vbGljZW5zZS5waHA/b3JkZXJ"

	condition:
		filesize < 500KB and not ( any of ( $gfp* ) ) and any of ( $sr* )
}

Strings (18 patterns)

IdentifierTypeValueModifiers
$sr0regex/\$_GET\s?\[.{1,30}\]\(\$_GET\s?\[/wide ascii
$sr1regex/\$_POST\s?\[.{1,30}\]\(\$_GET\s?\[/wide ascii
$sr2regex/\$_POST\s?\[.{1,30}\]\(\$_POST\s?\[/wide ascii
$sr3regex/\$_GET\s?\[.{1,30}\]\(\$_POST\s?\[/wide ascii
$sr4regex/\$_REQUEST\s?\[.{1,30}\]\(\$_REQUEST\s?\[/wide ascii
$sr5regex/\$_SERVER\s?\[HTTP_.{1,30}\]\(\$_SERVER\s?\[HTTP_/wide ascii
$gfp1text"eval(\"return [$serialised_parameter"
$gfp2text"$this->assert(strpos($styles, $"
$gfp3text"$module = new $_GET['module']($_GET['scope']);"
$gfp4text"$plugin->$_POST['action']($_POST['id']);"
$gfp5text"$_POST[partition_by]($_POST["
$gfp6text"$object = new $_REQUEST['type']($_REQUEST['id']);"
$gfp7text"The above example code can be easily exploited by passing in a string such as"
$gfp8text"Smarty_Internal_Debug::start_render($_template);"
$gfp9text"?p4yl04d=UNION%20SELECT%20'<?%20system($_GET['command']);%20?>',2,3%20INTO%20OUTFILE%20'/var/www/w3bsh3ll.php"
$gfp10text"[][}{;|]\\|\\\\[+=]\\|<?=>?"
$gfp11text"(eval (getenv \"EPROLOG\")))"
$gfp12text"ZmlsZV9nZXRfY29udGVudHMoJ2h0dHA6Ly9saWNlbnNlLm9wZW5jYXJ0LWFwaS5jb20vbGljZW5zZS5waHA/b3JkZXJ"

Condition

filesize < 500KB and not ( any of ( $gfp* ) ) and any of ( $sr* )

In plain words (Heuristic)

  • The file must be smaller than 500KB (a cheap guard that skips large files).
  • At least one pattern in ( $gfp* ) must match.
  • At least one pattern in ( $sr* ) 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

Sample hashes

Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).

  • ce739d65c31b3c7ea94357a38f7bd0dc264da052d4fd93a1eabb257f6e3a97a6
  • d870e971511ea3e082662f8e6ec22e8a8443ca79
  • 73fa97372b3bb829835270a5e20259163ecc3fdbf73ef2a99cb80709ea4572be

Licence & attribution

Author: Arnim Rupp (https://github.com/ruppde)

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

Licence: Detection Rule License 1.1 (stated in the rule's own meta)

“Detection Rule License 1.1 https://github.com/Neo23x0/signature-base/blob/master/LICENSE”

Original rule

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

Rule id: 5fef1063-2f9f-516e-86f6-cfd98bb05e6e

Metadata

importance70

Tags:FILE