Class: Dap::Filter::FilterVulnMatchHTTP
- Inherits:
-
Object
- Object
- Dap::Filter::FilterVulnMatchHTTP
- Includes:
- Base, BaseVulnMatch
- Defined in:
- lib/dap/filter/vulnmatch.rb
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from BaseVulnMatch
Methods included from Base
Instance Method Details
#check_elastic(doc) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/dap/filter/vulnmatch.rb', line 90 def check_elastic(doc) if not doc['http.path'] return [] end if not doc['http.path'] == '/_search' return [] end input = doc['http.url'] if doc['http.method'] == "POST" input = doc['http.body'] end if not input.match("script_fields") return [] end out = ['VULN-ELASTICSEARCH-RCE', 'CVE-2014-3120'] if input.match("Runtime") and input.match("getRuntime()") out += ["EXEC-SHELLCMD"] end if input.match("FileOutputStream") and input.match("URLClassLoader") out += ["EXEC-JAVA-CLASS"] end if input.match("getDeclaredConstructor") out += ['CVE-2015-1427'] end if input.match("metasploit.Payload") out += ['METASPLOIT'] end return out end |
#check_shellshock(doc) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/dap/filter/vulnmatch.rb', line 71 def check_shellshock(doc) if not doc["http.headers"] return [] end h = doc["http.headers"] sspattern = /\(\)\s*{\s*:;\s*};/ if h["user-agent"] and h["user-agent"] =~ sspattern return ['VULN-SHELLSHOCK', 'CVE-2014-6271'] end if h["referrer"] and h["referrer"] =~ sspattern return ['VULN-SHELLSHOCK', 'CVE-2014-6271'] end return [] end |
#process(doc) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/dap/filter/vulnmatch.rb', line 127 def process(doc) vulns = [] if doc['vulnerability'] vulns |= doc['vulnerability'] end vulns |= check_elastic(doc) vulns |= check_shellshock(doc) # see vulndb.rb, allows for simple matches to be added quickly SEARCHES[:http].each do | entry | success = true # all matches must go through entry[:match].each do | k, v | if not doc[k] success = false else m = doc[k].match(v) if not m success = false end end if not success break end end if success vulns |= entry[:cve] end end if vulns != [] doc['vulnerability'] = vulns end [ doc ] end |