deardaniel/secdata-raw huggingface dataset:
YARA Detection Rule: APT_Nazar_Svchost_Commands
Repository: Neo23x0/signature-base
Detects: Detects Nazar's svchost based on supported commands
Author: Itay Cohen
Reference: https://www.epicturla.com/blog/the-lost-nazar

Pattern signatures:
$str1 = { 33 31 34 00 36 36 36 00 33 31 33 00 }
        $str2 = { 33 31 32 00 33 31 35 00 35 35 35 00 }
        $str3 = { 39 39 39 00 35 39 39 00 34 39 39 00 }
        $str4 = { 32 30 39 00 32 30 31 00 32 30 30 00 }
        $str5 = { 31 39 39 00 31 31 39 00 31 38 39 00 31 33 39 00 33 31 31 00 }

Detection condition:
4 of them

Full rule:
rule APT_Nazar_Svchost_Commands {
    meta:
        description = "Detects Nazar's svchost based on supported commands"
        author = "Itay Cohen"
        date = "2020-04-26"
        reference = "https://www.epicturla.com/blog/the-lost-nazar"
        hash1 = "2fe9b76496a[PII_REDACTED]b6d35c012809bfa3ae8976813a7f5f4959402e3fbb6"
        hash2 = "be624acab7dfe6282bbb32b41b10a98b6189ab3a8d9520e7447214a7e5c27728"
        id = "3e02381d-de03-50c8-8bde-2974ee96b7c1"
    strings:
        $str1 = { 33 31 34 00 36 36 36 00 33 31 33 00 }
        $str2 = { 33 31 32 00 33 31 35 00 35 35 35 00 }
        $str3 = { 39 39 39 00 35 39 39 00 34 39 39 00 }
        $str4 = { 32 30 39 00 32 30 31 00 32 30 30 00 }
        $str5 = { 31 39 39 00 31 31 39 00 31 38 39 00 31 33 39 00 33 31 31 00 }
    condition:
        4 of them
}
YARA Detection Rule: APT_Nazar_Component_Guids
Repository: Neo23x0/signature-base
Detects: Detects Nazar Components by COM Objects' GUID
Author: Itay Cohen
Reference: https://www.epicturla.com/blog/the-lost-nazar

Pattern signatures:
$guid1_godown = { 98 B3 E5 F6 DF E3 6B 49 A2 AD C2 0F EA 30 DB FE } // Godown.dll IID
        $guid2_godown = { 31 4B CB DB B8 21 0F 4A BC 69 0C 3C E3 B6 6D 00 } // Godown.dll CLSID
        $guid3_godown = { AF 94 4E B6 6B D5 B4 48 B1 78 AF 07 23 E7 2A B5 } // probably Godown
        $guid4_filesystem = { 79 27 AB 37 34 F2 9D 4D B3 FB 59 A3 FA CB 8D 60 } // Filesystem.dll CLSID
        $guid6_filesystem = { 2D A1 2B 77 62 8A D3 4D B3 E8 92 DA 70 2E 6F 3D } // Filesystem.dll TypeLib IID
        $guid5_filesystem = { AB D3 13 CF 1C 6A E8 4A A3 74 DE D5 15 5D 6A 88 } // Filesystem.dll

Detection condition:
any of them

Full rule:
rule APT_Nazar_Component_Guids {
    meta:
        description = "Detects Nazar Components by COM Objects' GUID"
        author = "Itay Cohen"
        date = "2020-04-27"
        reference = "https://www.epicturla.com/blog/the-lost-nazar"
        hash1 = "1110c3e34b6bbaadc5082fabbdd69f492f3b1480724b879a3df0035ff487fd6f"
        hash2 = "1afe00b54856628d760b711534779da16c69f542ddc1bb835816aa92ed556390"
        hash3 = "2caedd0b2ea45761332a530327f74ca5b1a71301270d1e2e670b7fa34b6f338e"
        hash4 = "2fe9b76496a[PII_REDACTED]b6d35c012809bfa3ae8976813a7f5f4959402e3fbb6"
        hash5 = "460eba344823766fe7c8f13b647b4d5d979ce4041dd5cb4a6d538783d96b2ef8"
        hash6 = "4d0ab3951df93589a874192569cac88f7107f595600e274f52e2b75f68593bca"
        hash7 = "75e4d73252c753cd8e177820eb261cd72fecd7360cc8ec3feeab7bd129c01ff6"
        hash8 = "8fb9a22b20a338d90c7ceb9424d079a61ca7ccb7f78ffb7d74d2f403ae9fbeec"
        hash9 = "967ac245e8429e3b725463a5c4c42fbdf98385ee6f25254e48b9492df21f2d0b"
        hash10 = "be624acab7dfe6282bbb32b41b10a98b6189ab3a8d9520e7447214a7e5c27728"
        hash11 = "d34a996826ea5a028f5b4713c797247913f036ca0063cc4c18d8b04736fa0b65"
        hash12 = "d9801b4da1dbc5264e83029abb93e800d3c9971c650ecc2df5f85bcc10c7bd61"
        hash13 = "eb705459c2b37fba5747c73ce4870497aa1d4de22c97aaea4af38cdc899b51d3"
        id = "1bdc0b54-4903-559d-9037-450470fc7ef7"
    strings:
        $guid1_godown = { 98 B3 E5 F6 DF E3 6B 49 A2 AD C2 0F EA 30 DB FE } // Godown.dll IID
        $guid2_godown = { 31 4B CB DB B8 21 0F 4A BC 69 0C 3C E3 B6 6D 00 } // Godown.dll CLSID
        $guid3_godown = { AF 94 4E B6 6B D5 B4 48 B1 78 AF 07 23 E7 2A B5 } // probably Godown
        $guid4_filesystem = { 79 27 AB 37 34 F2 9D 4D B3 FB 59 A3 FA CB 8D 60 } // Filesystem.dll CLSID
        $guid6_filesystem = { 2D A1 2B 77 62 8A D3 4D B3 E8 92 DA 70 2E 6F 3D } // Filesystem.dll TypeLib IID
        $guid5_filesystem = { AB D3 13 CF 1C 6A E8 4A A3 74 DE D5 15 5D 6A 88 } // Filesystem.dll 
    condition:
YARA Detection Rule: LightFTP_fftp_x86_64
Repository: Neo23x0/signature-base
Detects: Detects a light FTP server
Author: Florian Roth (Nextron Systems)
Reference: https://github.com/hfiref0x/LightFTP

Pattern signatures:
$s1 = "fftp.cfg" fullword wide
		$s2 = "220 LightFTP server v1.0 ready" fullword ascii
		$s3 = "*FTP thread exit*" fullword wide
		$s4 = "PASS->logon successful" fullword ascii
		$s5 = "250 Requested file action okay, completed." fullword ascii

Detection condition:
uint16(0) == 0x5a4d and filesize < 250KB and 4 of them

Full rule:
rule LightFTP_fftp_x86_64 {
	meta:
		description = "Detects a light FTP server"
		license = "Detection Rule License 1.1 https://github.com/Neo23x0/signature-base/blob/master/LICENSE"
		author = "Florian Roth (Nextron Systems)"
		reference = "https://github.com/hfiref0x/LightFTP"
		date = "2015-05-14"
		hash1 = "989525f85abef05581ccab673e81df3f5d50be36"
		hash2 = "5884aeca33429830b39eba6d3ddb00680037faf4"
		score = 50
		id = "9b62e990-1d8b-5d30-bb58-1f7f12552834"
	strings:
		$s1 = "fftp.cfg" fullword wide
		$s2 = "220 LightFTP server v1.0 ready" fullword ascii
		$s3 = "*FTP thread exit*" fullword wide
		$s4 = "PASS->logon successful" fullword ascii
		$s5 = "250 Requested file action okay, completed." fullword ascii
	condition:
		uint16(0) == 0x5a4d and filesize < 250KB and 4 of them
}
YARA Detection Rule: LightFTP_Config
Repository: Neo23x0/signature-base
Detects: Detects a light FTP server - config file
Author: Florian Roth (Nextron Systems)
Reference: https://github.com/hfiref0x/LightFTP

Pattern signatures:
$s2 = "maxusers=" wide
		$s6 = "[ftpconfig]" fullword wide
		$s8 = "accs=readonly" fullword wide
		$s9 = "[anonymous]" fullword wide
		$s10 = "accs=" fullword wide
		$s11 = "pswd=" fullword wide

Detection condition:
uint16(0) == 0xfeff and filesize < 1KB and all of them

Full rule:
rule LightFTP_Config {
	meta:
		description = "Detects a light FTP server - config file"
		license = "Detection Rule License 1.1 https://github.com/Neo23x0/signature-base/blob/master/LICENSE"
		author = "Florian Roth (Nextron Systems)"
		reference = "https://github.com/hfiref0x/LightFTP"
		date = "2015-05-14"
		hash = "ce[PII_REDACTED]d39775af4a48550eefa3908323c5"
		id = "02ee1d04-1425-5dfd-9b9a-cd378aeda311"
	strings:
		$s2 = "maxusers=" wide
		$s6 = "[ftpconfig]" fullword wide
		$s8 = "accs=readonly" fullword wide
		$s9 = "[anonymous]" fullword wide
		$s10 = "accs=" fullword wide
		$s11 = "pswd=" fullword wide
	condition:
		uint16(0) == 0xfeff and filesize < 1KB and all of them
}
YARA Detection Rule: APT_UNC4841_ESG_Barracuda_CVE_2023_2868_Forensic_Artifacts_Jun23_1
Repository: Neo23x0/signature-base
Detects: Detects forensic artifacts found in the exploitation of CVE-2023-2868 in Barracuda ESG devices by UNC4841
Author: Florian Roth
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$x01 = "=;ee=ba;G=s;_ech_o $abcdefg_${ee}se64" ascii
      $x02 = ";echo $abcdefg | base64 -d | sh" ascii
      $x03 = "setsid sh -c \"mkfifo /tmp/p" ascii
      $x04 = "sh -i </tmp/p 2>&1" ascii
      $x05 = "if string.match(hdr:body(), \"^[%w%+/=" ascii
      $x06 = "setsid sh -c \"/sbin/BarracudaMailService eth0\""
      $x07 = "echo \"set the bvp ok\""
      $x08 = "find ${path} -type f ! -name $excludeFileNameKeyword | while read line ;"
      $x09 = " /mail/mstore | xargs -i cp {} /usr/share/.uc/"
      $x10 = "tar -T /mail/mstore/tmplist -czvf "

      $sa1 = "sh -c wget --no-check-certificate http"
      $sa2 = ".tar;chmod +x "

Detection condition:
1 of ($x*)
      or all of ($sa*)

Full rule:
rule APT_UNC4841_ESG_Barracuda_CVE_2023_2868_Forensic_Artifacts_Jun23_1 : SCRIPT {
   meta:
      description = "Detects forensic artifacts found in the exploitation of CVE-2023-2868 in Barracuda ESG devices by UNC4841"
      author = "Florian Roth"
      reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
      date = "2023-06-15"
      modified = "2023-06-16"
      score = 75
      id = "50518fa1-33de-5fe5-b957-904d976fb29a"
   strings:
      $x01 = "=;ee=ba;G=s;_ech_o $abcdefg_${ee}se64" ascii
      $x02 = ";echo $abcdefg | base64 -d | sh" ascii
      $x03 = "setsid sh -c \"mkfifo /tmp/p" ascii
      $x04 = "sh -i </tmp/p 2>&1" ascii
      $x05 = "if string.match(hdr:body(), \"^[%w%+/=" ascii
      $x06 = "setsid sh -c \"/sbin/BarracudaMailService eth0\""
      $x07 = "echo \"set the bvp ok\""
      $x08 = "find ${path} -type f ! -name $excludeFileNameKeyword | while read line ;"
      $x09 = " /mail/mstore | xargs -i cp {} /usr/share/.uc/"
      $x10 = "tar -T /mail/mstore/tmplist -czvf "

      $sa1 = "sh -c wget --no-check-certificate http"
      $sa2 = ".tar;chmod +x "
   condition:
      1 of ($x*)
      or all of ($sa*)
}
YARA Detection Rule: APT_MAL_UNC4841_SEASPY_Jun23_1
Repository: Neo23x0/signature-base
Detects: Detects SEASPY malware used by UNC4841 in attacks against Barracuda ESG appliances exploiting CVE-2023-2868
Author: Florian Roth
Reference: https://blog.talosintelligence.com/alchimist-offensive-framework/

Pattern signatures:
$sx1 = "usage: ./BarracudaMailService <Network-Interface>. e.g.: ./BarracudaMailService eth0" ascii fullword
      $s1 = "fcntl.tmp.amd64." ascii
      $s2 = "Child process id:%d" ascii fullword
      $s3 = "[*]Success!" ascii fullword
      $s4 = "NO port code" ascii 
      $s5 = "enter open tty shell" ascii

      $op1 = { 48 89 c6 f3 a6 0f 84 f7 01 00 00 bf 6c 84 5f 00 b9 05 00 00 00 48 89 c6 f3 a6 0f 84 6a 01 00 00 }
      $op2 = { f3 a6 0f 84 d2 00 00 00 48 89 de bf 51 5e 61 00 b9 05 00 00 00 f3 a6 74 21 48 89 de }
      $op3 = { 72 de 45 89 f4 e9 b8 f4 ff ff 48 8b 73 08 45 85 e4 ba 49 3d 62 00 b8 44 81 62 00 48 0f 45 d0 }

Detection condition:
uint16(0) == 0x457f
      and filesize < 9000KB
      and 3 of them
      or 5 of them

Full rule:
rule APT_MAL_UNC4841_SEASPY_Jun23_1 {
   meta:
      description = "Detects SEASPY malware used by UNC4841 in attacks against Barracuda ESG appliances exploiting CVE-2023-2868"
      author = "Florian Roth"
      reference = "https://blog.talosintelligence.com/alchimist-offensive-framework/"
      date = "2023-06-16"
      score = 85
      hash1 = "3f26a13f023ad0dcd7f2aa4e7771bba74910ee227b4b36ff72edc5f07336f115"
      id = "bcff58f8-87f6-5371-8b96-5d4c0f349000"
   strings:
      $sx1 = "usage: ./BarracudaMailService <Network-Interface>. e.g.: ./BarracudaMailService eth0" ascii fullword
      $s1 = "fcntl.tmp.amd64." ascii
      $s2 = "Child process id:%d" ascii fullword
      $s3 = "[*]Success!" ascii fullword
      $s4 = "NO port code" ascii 
      $s5 = "enter open tty shell" ascii

      $op1 = { 48 89 c6 f3 a6 0f 84 f7 01 00 00 bf 6c 84 5f 00 b9 05 00 00 00 48 89 c6 f3 a6 0f 84 6a 01 00 00 }
      $op2 = { f3 a6 0f 84 d2 00 00 00 48 89 de bf 51 5e 61 00 b9 05 00 00 00 f3 a6 74 21 48 89 de }
      $op3 = { 72 de 45 89 f4 e9 b8 f4 ff ff 48 8b 73 08 45 85 e4 ba 49 3d 62 00 b8 44 81 62 00 48 0f 45 d0 }
   condition:
      uint16(0) == 0x457f
      and filesize < 9000KB
      and 3 of them
      or 5 of them
}
YARA Detection Rule: APT_MAL_UNC4841_SEASPY_LUA_Jun23_1
Repository: Neo23x0/signature-base
Detects: Detects SEASPY malware related LUA script
Author: Florian Roth
Reference: https://blog.talosintelligence.com/alchimist-offensive-framework/

Pattern signatures:
$x1 = "os.execute('rverify'..' /tmp/'..attachment:filename())" ascii fullword
      $x2 = "log.debug(\"--- opening archive [%s], mimetype [%s]\", tmpfile" ascii fullword

      $xe1 = "os.execute('rverify'..' /tmp/'..attachment:filename())" ascii base64
      $xe2 = "log.debug(\"--- opening archive [%s], mimetype [%s]\", tmpfile" ascii base64

Detection condition:
filesize < 500KB and 1 of them

Full rule:
rule APT_MAL_UNC4841_SEASPY_LUA_Jun23_1 {
   meta:
      description = "Detects SEASPY malware related LUA script"
      author = "Florian Roth"
      reference = "https://blog.talosintelligence.com/alchimist-offensive-framework/"
      date = "2023-06-16"
      score = 90
      hash1 = "56e8066bf83ff6fe0cec92aede90f6722260e0a3f169fc163ed88589bffd7451"
      id = "a44861d0-107e-589b-8cf1-3fbc2f5c78dc"
   strings:
      $x1 = "os.execute('rverify'..' /tmp/'..attachment:filename())" ascii fullword
      $x2 = "log.debug(\"--- opening archive [%s], mimetype [%s]\", tmpfile" ascii fullword

      $xe1 = "os.execute('rverify'..' /tmp/'..attachment:filename())" ascii base64
      $xe2 = "log.debug(\"--- opening archive [%s], mimetype [%s]\", tmpfile" ascii base64
   condition:
      filesize < 500KB and 1 of them
}
YARA Detection Rule: APT_HKTL_Proxy_Tool_Jun23_1
Repository: Neo23x0/signature-base
Detects: Detects agent used as proxy tool in UNC4841 intrusions - possibly Alchemist C2 framework implant
Author: Florian Roth
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
//$a1 = "Go build" // not available in all samples
      $a2 = "/src/runtime/panic.go"

      $s1 = "main.handleClientRequest" ascii fullword
      $s2 = "main.sockIP.toAddr" ascii fullword
      // $s3 = "main.slave" ascii fullword

Detection condition:
( 
         uint16(0) == 0x5a4d // Windows PE
         or uint32be(0) == 0x7f454c46 // ELF
         or uint16(0) == 0xfeca or uint16(0) == 0xfacf or uint32(0) == 0xbebafeca or uint32(0) == 0xbebafeca // MacOS
      )
      and filesize < 10MB 
      and all of them

Full rule:
rule APT_HKTL_Proxy_Tool_Jun23_1 {
   meta:
      description = "Detects agent used as proxy tool in UNC4841 intrusions - possibly Alchemist C2 framework implant"
      author = "Florian Roth"
      reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
      date = "2023-06-16"
      score = 75
      hash1 = "ca72fa64ed0a9c22d341a557c6e7c1b6a7264b0c4de0b6f717dd44bddf550bca"
      hash2 = "57e4b180fd559f15b59c43fb3335bd59435d4d76c4676e51a06c6b257ce67fb2"
      id = "0e[PII_REDACTED]-53c2-a6d2-14c07794125a"
   strings:
      //$a1 = "Go build" // not available in all samples
      $a2 = "/src/runtime/panic.go"

      $s1 = "main.handleClientRequest" ascii fullword
      $s2 = "main.sockIP.toAddr" ascii fullword
      // $s3 = "main.slave" ascii fullword
   condition:
      ( 
         uint16(0) == 0x5a4d // Windows PE
         or uint32be(0) == 0x7f454c46 // ELF
         or uint16(0) == 0xfeca or uint16(0) == 0xfacf or uint32(0) == 0xbebafeca or uint32(0) == 0xbebafeca // MacOS
      )
      and filesize < 10MB 
      and all of them
}
YARA Detection Rule: SUSP_FScan_Port_Scanner_Output_Jun23
Repository: Neo23x0/signature-base
Detects: Detects output generated by the command line port scanner FScan
Author: Florian Roth
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$s1 = "[*] NetInfo:" ascii
      $s2 = ":443 open" ascii
      $s3 = "   [->]"

Detection condition:
filesize < 800KB and all of them

Full rule:
rule SUSP_FScan_Port_Scanner_Output_Jun23 : SCRIPT {
   meta:
      description = "Detects output generated by the command line port scanner FScan"
      author = "Florian Roth"
      reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
      date = "2023-06-15"
      score = 70
      id = "7eb4b27f-0c5b-5d7e-b759-95d7894d5822"
   strings:
      $s1 = "[*] NetInfo:" ascii
      $s2 = ":443 open" ascii
      $s3 = "   [->]"
   condition:
      filesize < 800KB and all of them
}
YARA Detection Rule: SUSP_PY_Shell_Spawn_Jun23_1
Repository: Neo23x0/signature-base
Detects: Detects suspicious one-liner to spawn a shell using Python
Author: Florian Roth
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$x1 = "python -c import pty;pty.spawn(\"/bin/" ascii

Detection condition:
1 of them

Full rule:
rule SUSP_PY_Shell_Spawn_Jun23_1 : SCRIPT {
   meta:
      description = "Detects suspicious one-liner to spawn a shell using Python"
      author = "Florian Roth"
      reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
      date = "2023-06-15"
      score = 70
      id = "15fd2c9a-c425-5d4d-9209-fd3826074d6c"
   strings:
      $x1 = "python -c import pty;pty.spawn(\"/bin/" ascii
   condition:
      1 of them
}
YARA Detection Rule: APT_MAL_Hunting_LUA_SEASIDE_1
Repository: Neo23x0/signature-base
Detects: Hunting rule looking for strings observed in SEASIDE samples.
Author: Mandiant
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$s1 = "function on_helo()"
        $s2 = "local bindex,eindex = string.find(helo,'.onion')" 
        $s3 = "helosend = 'pd'..' '..helosend" 
        $s4 = "os.execute(helosend)"

Detection condition:
filesize < 1MB and all of ($s*)

Full rule:
rule APT_MAL_Hunting_LUA_SEASIDE_1 {
    meta:
        description = "Hunting rule looking for strings observed in SEASIDE samples."
        author = "Mandiant"
        date = "2023-06-15"
        score = 70
        reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
        hash = "cd2813f0260d63ad5adf0446253c2172"
        id = "86eaff7b-4ca0-53cd-8886-da66a36c778f"
    strings:
        $s1 = "function on_helo()"
        $s2 = "local bindex,eindex = string.find(helo,'.onion')" 
        $s3 = "helosend = 'pd'..' '..helosend" 
        $s4 = "os.execute(helosend)" 
    condition:
        filesize < 1MB and all of ($s*)
}
YARA Detection Rule: APT_MAL_LNX_Hunting_Linux_WHIRLPOOL_1
Repository: Neo23x0/signature-base
Detects: Hunting rule looking for strings observed in WHIRLPOOL samples.
Author: Mandiant
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$s1 = "error -1 exit" fullword
        $s2 = "create socket error: %s(error: %d)\n" fullword
        $s3 = "connect error: %s(error: %d)\n" fullword
        $s4 = {C7 00 20 32 3E 26 66 C7 40 04 31 00}
        $c1 = "plain_connect" fullword
        $c2 = "ssl_connect" fullword
        $c3 = "SSLShell.c" fullword

Detection condition:
uint32(0) == 0x464c457f and filesize < 15MB and (all of ($s*) or all of ($c*))

Full rule:
rule APT_MAL_LNX_Hunting_Linux_WHIRLPOOL_1 {
    meta:
        description = "Hunting rule looking for strings observed in WHIRLPOOL samples."
        author = "Mandiant"
        date = "2023-06-15"
        score = 70
        reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
        hash = "177add288b289d43236d2dba33e65956"
        id = "a997bd65-c502-53a0-8bb8-62daaa916f0d"
    strings:
        $s1 = "error -1 exit" fullword
        $s2 = "create socket error: %s(error: %d)\n" fullword
        $s3 = "connect error: %s(error: %d)\n" fullword
        $s4 = {C7 00 20 32 3E 26 66 C7 40 04 31 00}
        $c1 = "plain_connect" fullword
        $c2 = "ssl_connect" fullword
        $c3 = "SSLShell.c" fullword
    condition:
        uint32(0) == 0x464c457f and filesize < 15MB and (all of ($s*) or all of ($c*))
}
YARA Detection Rule: APT_MAL_LUA_Hunting_SKIPJACK_1
Repository: Neo23x0/signature-base
Detects: Hunting rule looking for strings observed in SKIPJACK installation script.
Author: Mandiant
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$str1 = "hdr:name() == 'Content-ID'" base64
        $str2 = "hdr:body() ~= nil" base64
        $str3 = "string.match(hdr:body(),\"^[%w%+/=\\r\\n]+$\")" base64
        $str4 = "openssl aes-256-cbc" base64
        $str5 = "mod_content.lua" 
        $str6 = "#!/bin/sh"

Detection condition:
all of them

Full rule:
rule APT_MAL_LUA_Hunting_SKIPJACK_1 {
    meta:
        author = "Mandiant"
        date = "2023-06-15"
        reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
        description = "Hunting rule looking for strings observed in SKIPJACK installation script."
        hash = "e4e86c273a2b67a605f5d4686783e0cc"
        score = 70
        id = "0026375c-7f37-5ef9-bd55-5b9fc499e5d2"
    strings:
        $str1 = "hdr:name() == 'Content-ID'" base64
        $str2 = "hdr:body() ~= nil" base64
        $str3 = "string.match(hdr:body(),\"^[%w%+/=\\r\\n]+$\")" base64
        $str4 = "openssl aes-256-cbc" base64
        $str5 = "mod_content.lua" 
        $str6 = "#!/bin/sh" 
    condition:
        all of them
}
YARA Detection Rule: APT_MAL_LUA_Hunting_Lua_SKIPJACK_2
Repository: Neo23x0/signature-base
Detects: Hunting rule looking for strings observed in SKIPJACK samples.
Author: Mandiant
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$str1 = "hdr:name() == 'Content-ID'" 
        $str2 = "hdr:body() ~= nil" 
        $str3 = "string.match(hdr:body(),\"^[%w%+/=\\r\\n]+$\")" 
        $str4 = "openssl aes-256-cbc" 
        $str5 = "| base64 -d| sh 2>"

Detection condition:
all of them

Full rule:
rule APT_MAL_LUA_Hunting_Lua_SKIPJACK_2 {
    meta:
        author = "Mandiant"
        date = "2023-06-15"
        reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
        description = "Hunting rule looking for strings observed in SKIPJACK samples."
        hash = "87847445f[PII_REDACTED]d70f2a812728f"
        score = 70
        id = "e1eac294-fe60-5bb2-bae4-0f7bcbe6b1db"
    strings:
        $str1 = "hdr:name() == 'Content-ID'" 
        $str2 = "hdr:body() ~= nil" 
        $str3 = "string.match(hdr:body(),\"^[%w%+/=\\r\\n]+$\")" 
        $str4 = "openssl aes-256-cbc" 
        $str5 = "| base64 -d| sh 2>" 
    condition:
        all of them
}
YARA Detection Rule: APT_MAL_LUA_Hunting_Lua_SEASPRAY_1
Repository: Neo23x0/signature-base
Detects: Hunting rule looking for strings observed in SEASPRAY samples.
Author: Mandiant
Reference: https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally

Pattern signatures:
$str1 = "string.find(attachment:filename(),'obt075') ~= nil" 
        $str2 = "os.execute('cp '..tostring(tmpfile)..' /tmp/'..attachment:filename())" 
        $str3 = "os.execute('rverify'..' /tmp/'..attachment:filename())"

Detection condition:
all of them

Full rule:
rule APT_MAL_LUA_Hunting_Lua_SEASPRAY_1 {
    meta:
        author = "Mandiant"
        date = "2023-06-15"
        reference = "https://www.mandiant.com/resources/blog/barracuda-esg-exploited-globally"
        description = "Hunting rule looking for strings observed in SEASPRAY samples."
        hash = "35cf6faf442d325961935f660e2ab5a0"
        score = 70
        id = "8c744b85-b61e-56d0-8a9e-ae6a954e1b95"
    strings:
        $str1 = "string.find(attachment:filename(),'obt075') ~= nil" 
        $str2 = "os.execute('cp '..tostring(tmpfile)..' /tmp/'..attachment:filename())" 
        $str3 = "os.execute('rverify'..' /tmp/'..attachment:filename())" 
    condition:
        all of them
}