-
Notifications
You must be signed in to change notification settings - Fork 6
/
cve_2019_12255.lua
51 lines (49 loc) · 1.62 KB
/
cve_2019_12255.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--[[
-- Author: Axel Boesenach
--
-- TCP-Options Field parser for Suricata to check for CVE-2019-12255
--
-- Suricata rule keyword
-- luajit:cve_2019_12255.lua;
--
-- Suricata rule
-- alert ip any any -> any any (
-- msg:"EXPLOIT - VxWorks CVE-2019-12255 Integer Underflow Observed";
-- flow:to_server;
-- flags:PUA;
-- dsize:>1500;
-- luajit:cve_2019_12255.lua;
-- threshold:type limit, track by_src, count 1, seconds 3600;
-- classtype:attempted-admin;
-- reference:url,armis.com/urgent11/;
-- metadata:created_at 2019-11-05;
-- metadata:CVE 2019-12255;
-- sid:2;
-- rev:1;
-- )
--
-- The script checks for CVE-2019-12255, the packet that is checked needs to have the PSH, ACK, and URG
-- flags set, and have a payload size that exceeds 1500 bytes. It then checks if the value of the urgent
-- pointer is set to 0, this will cause an integer underflow on vulnerable devices.
]]
-- Initialize the script
function init (args)
local needs = {}
needs["packet"] = tostring(true)
return needs
end
-- Try and match the condition
function match (args)
for index, data in pairs(args) do
--[[
-- The exploit is based on underflowing the urgent pointer by setting it to 0.
-- The flaw causes the length constraint in the recv() of the target to be ignored,
-- and will copy all of the available data from the TCP window to the user supplied
-- buffer. The rule checks if the payload exceeds 1500 bytes.
]]
if string.byte(data, 55) == 0 and string.byte(data, 56) == 0 then
return 1
end
end
return 0
end