-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathhttp-default-accounts-fingerprints-nndefaccts.lua
13269 lines (12782 loc) · 457 KB
/
http-default-accounts-fingerprints-nndefaccts.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
126
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
This file is part of NNdefaccts, an alternate fingerprint dataset for
Nmap script http-default-accounts.
NNdefaccts is Copyright (c) 2012-2025 by nnposter
(nnposter /at/ users.sourceforge.net, <https://github.com/nnposter>)
NNdefaccts is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
NNdefaccts is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.
Note that NNdefaccts is licensed separately from Nmap. By obtaining
a custom license for Nmap you are not automatically entitled to modify or
distribute the NNdefaccts dataset to the same extent as Nmap itself and,
conversely, licensing NNdefaccts does not cover Nmap. For details, see
<https://github.com/nnposter/nndefaccts/blob/master/COPYING>.
You can obtain the latest version of the dataset from its public repository
at <https://github.com/nnposter/nndefaccts/>.
To report bugs and other problems, contribute patches, request a feature,
provide generic feedback, etc., please see instructions posted at
<https://github.com/nnposter/nndefaccts/blob/master/README.md>.
]]
-- luacheck: std lua53, new globals fingerprints
-- luacheck: ignore 212/host 212/port 212/path 212/user 212/pass
-- luacheck: no max line length
local base64 = require "base64"
local http = require "http"
local json = require "json"
local math = require "math"
local os = require "os"
local shortport = require "shortport"
local stdnse = require "stdnse"
local table = require "table"
local url = require "url"
local have_openssl, openssl = pcall(require, "openssl")
local have_rand, rand = pcall(require, "rand")
local have_stringaux, stringaux = pcall(require, "stringaux")
local have_tableaux, tableaux = pcall(require, "tableaux")
---
-- http-default-accounts-fingerprints-nndefaccts.lua
-- This file contains fingerprint data for http-default-accounts.nse
--
-- STRUCTURE:
-- * <code>name</code> - Descriptive name
-- * <code>cpe</code> - Official CPE Dictionary entry (optional)
-- * <code>category</code> - Category
-- * <code>login_combos</code> - Table of default credential pairs
---- * <code>username</code>
---- * <code>password</code>
-- * <code>paths</code> - Table of likely locations (paths) of the target
-- * <code>target_check</code> - Validation function of the target
-- (optional but highly recommended)
-- * <code>login_check</code> - Login function of the target
---
---
-- Backwards compatibility provisions for library rand
---
if not have_rand then
rand = {}
end
if not rand.random_string then
rand.random_string = stdnse.generate_random_string
end
---
-- Generates a random alphanumeric string.
--
-- @param len Length of the output string.
-- @return A random string consisting of letters and digits
---
local function random_alnum (len)
return rand.random_string(len, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
end
---
-- Generates a random hexadecimal string.
--
-- @param len Length of the output string.
-- @return A random string consisting of hexadecimal digits
---
local function random_hex (len)
return rand.random_string(len, "0123456789abcdef")
end
---
-- Backwards compatibility provisions for library stringaux
---
if not have_stringaux then
stringaux = {}
end
if not stringaux.ipattern then
stringaux.ipattern = stdnse.generate_case_insensitive_pattern
end
---
-- Backwards compatibility provisions for library tableaux
---
if not have_tableaux then
tableaux = {}
end
if not tableaux.tcopy then
tableaux.tcopy =
function (tbl)
local clone = {}
for k,v in pairs(tbl) do
clone[k] = type(v) == "table" and tableaux.tcopy(v) or v
end
return clone
end
end
if not tableaux.contains then
tableaux.contains = stdnse.contains
end
---
-- Requests given path using http.get() but disabling cache and redirects.
-- @param host The host to connect to
-- @param port The port to connect to
-- @param path The path to retrieve
-- @param options [optional] A table of HTTP request options
-- @return A response table (see library http.lua for description)
---
local function http_get_simple (host, port, path, options)
local opts = tableaux.tcopy(options or {})
opts.bypass_cache = true
opts.no_cache = true
opts.redirect_ok = false
return http.get(host, port, path, opts)
end
---
-- Requests given path using http.post() but disabling cache and redirects.
-- (The current implementation of http.post() does not use either; this is
-- a defensive wrapper to guard against future problems.)
-- @param host The host to connect to
-- @param port The port to connect to
-- @param path The path to retrieve
-- @param options [optional] A table of HTTP request options
-- @param postdata A string or a table of data to be posted
-- @return A response table (see library http.lua for description)
---
local function http_post_simple (host, port, path, options, postdata)
local opts = tableaux.tcopy(options or {})
opts.no_cache = true
opts.redirect_ok = false
return http.post(host, port, path, opts, nil, postdata)
end
---
-- Requests given path using http_post_simple() with the body formatted as
-- Content-Type multipart/form-data.
-- @param host The host to connect to
-- @param port The port to connect to
-- @param path The path to retrieve
-- @param options [optional] A table of HTTP request options
-- @param postdata A table of data to be posted
-- @return A response table (see library http.lua for description)
---
local function http_post_multipart (host, port, path, options, postdata)
local boundary = ("-"):rep(20)
.. math.random(1000000, 9999999)
.. math.random(1000000, 9999999)
local opts = tableaux.tcopy(options or {})
opts.header = opts.header or {}
opts.header["Content-Type"] = "multipart/form-data; boundary=" .. boundary
if type(postdata) ~= "table" then
return {status = nil,
["status-line"] = "POST data must be a table",
header = {},
rawheader = {}}
end
boundary = "--" .. boundary
local body = {}
for k, v in pairs(postdata) do
table.insert(body, boundary)
table.insert(body, ('Content-Disposition: form-data; name="%s"'):format(k))
table.insert(body, "")
table.insert(body, v)
end
table.insert(body, boundary .. "--")
table.insert(body, "")
return http_post_simple (host, port, path, opts, table.concat(body, "\r\n"))
end
---
-- Requests given path using native HTTP authentication.
-- @param host Host table
-- @param port Port table
-- @param path Path to request
-- @param user HTTP authentication username
-- @param pass HTTP authentication password
-- @param digest true: digest auth, false: basic auth, "any": try to detect
-- @return True if login in was successful
---
local function try_http_auth (host, port, path, user, pass, digest)
if digest == "any" then
local resp = http_get_simple(host, port, path)
local auth = (resp.header["www-authenticate"] or ""):lower():match("^%w+")
if not auth then return end
digest = auth == "digest"
end
local creds = {username = user, password = pass, digest = digest}
local resp = http_get_simple(host, port, path, {auth=creds})
local status = resp.status
return status and not (status >= 400 and status <= 405 or status >= 500)
end
---
-- Returns authentication realm advertised in an HTTP response
-- @param response HTTP response object, such as a result from http.get()
-- @return realm found in response header WWW-Authenticate
-- (or nil if not present)
---
local function http_auth_realm (response)
local auth = response.header["www-authenticate"] or ""
-- NB: "OEM Netcam" devices lack the closing double quote
return auth:match('%srealm%s*=%s*"([^"]*)')
end
---
-- Tests whether an HTTP response sets a named cookie with a given value
-- @param response a standard HTTP response object
-- @param name a case-insensitive cookie name that must be set
-- @param pattern to validate the cookie value
-- @return cookie value if such a cookie is found
---
local function get_cookie (response, name, pattern)
name = name:lower()
for _, ck in ipairs(response.cookies or {}) do
if ck.name:lower() == name and (not pattern or ck.value:find(pattern)) then
return ck.value
end
end
return false
end
---
-- Parses an HTML tag and returns parsed attributes
-- @param html a string representing HTML tag. It is expected that the first
-- and last characters are angle brackets.
-- @return table of attributes with their names converted to lowercase
---
local function parse_tag (html)
local attrs = {}
local _, pos = html:find("^<%f[%w][%w-]+[^%w-]")
while true do
local attr, equal
_, pos, attr, equal = html:find("%f[%w]([%w-]+)%s*(=?)%s*", pos)
if not pos then break end
local oldpos = pos + 1
if equal == "=" then
local c = html:sub(oldpos, oldpos)
if c == "\"" or c == "'" then
oldpos = oldpos + 1
pos = html:find(c, oldpos, true)
else
pos = html:find("[%s>]", oldpos)
end
if not pos then break end
else
pos = oldpos
end
attrs[attr:lower()] = html:sub(oldpos, pos - 1)
end
return attrs
end
---
-- Searches given HTML string for an element tag that meets given attribute
-- critera and returns its position and all its attributes
-- @param html a string representing HTML text
-- @param elem an element to search for (for example "img" or "div")
-- @param criteria a table of attribute names and corresponding patterns,
-- for example {id="^secret$"}.
-- The patterns are treated as case-insensitive. (optional)
-- @param init a string position from which to start searching (optional)
-- @return position of the opening angle bracket of the found tag or nil
-- @return position of the closing angle bracket of the found tag or nil
-- @return table of tag attributes with their names converted to lowercase
---
local function find_tag (html, elem, criteria, init)
local icrit = {}
for cnam, cptn in pairs(criteria or {}) do
icrit[cnam:lower()] = stringaux.ipattern(cptn)
end
local tptn = stringaux.ipattern("<" .. elem:gsub("%-", "%%-") .. "%f[%s/>].->")
local start
local stop = init
while true do
start, stop = html:find(tptn, stop)
if not start then break end
local attrs = parse_tag(html:sub(start, stop))
local found = true
for cnam, cptn in pairs(icrit) do
local cval = attrs[cnam]
if not (cval and cval:find(cptn)) then
found = false
break
end
end
if found then return start, stop, attrs end
end
return
end
---
-- Searches given HTML string for an element tag that meets given attribute
-- critera and returns all its attributes
-- @param html a string representing HTML text
-- @param elem an element to search for (for example "img" or "div")
-- @param criteria a table of attribute names and corresponding patterns,
-- for example {id="^secret$"}.
-- The patterns are treated as case-insensitive. (optional)
-- @param init a string position from which to start searching (optional)
-- @return table of tag attributes with their names converted to lowercase
---
local function get_tag (html, elem, criteria, init)
local _, _, attrs = find_tag(html, elem, criteria, init)
return attrs
end
---
-- Builds an iterator function that searches given HTML string for element tags
-- that meet given attribute critera
-- @param html a string representing HTML text
-- @param elem an element to search for (for example "img" or "div")
-- @param criteria a table of attribute names and corresponding patterns,
-- for example {type="^hidden$"}.
-- The patterns are treated as case-insensitive. (optional)
-- @param init a string position from which to start searching (optional)
-- @return iterator
---
local function get_tags (html, elem, criteria, init)
init = (init or 1) - 1
return function ()
local _, attrs
_, init, attrs = find_tag(html, elem, criteria, (init or #html) + 1)
return attrs
end
end
---
-- Searches given HTML string for an element tag that meets given attribute
-- critera and returns inner HTML of the corresponding element
-- (Nested elements of the same type are not supported.)
-- @param html a string representing HTML text
-- @param elem an element to search for (for example "div" or "title")
-- @param criteria a table of attribute names and corresponding patterns,
-- for example {id="^secret$"}.
-- The patterns are treated as case-insensitive. (optional)
-- @param init a string position from which to start searching (optional)
-- @return inner HTML
---
local function get_tag_html (html, elem, criteria, init)
local _, start = find_tag(html, elem, criteria, init)
if not start then return end
if html:sub(start - 1, start - 1) == "/" then
return ""
end
start = start + 1
local stop = html:find(stringaux.ipattern("</" .. elem:gsub("%-", "%%-") .. "[%s>]"), start)
return stop and html:sub(start, stop - 1) or nil
end
---
-- Searches given HTML string for a meta refresh tag and returns the target URL
-- @param html a string representing HTML text
-- @param criteria a pattern to validate the extracted target URL
-- for example "/cgi%-bin/login$".
-- The pattern is treated as case-insensitive. (optional)
-- @return the target URL or nil (if the HTML does not contain a refresh tag
-- or the target URL does not match the criteria)
---
local function get_refresh_url (html, criteria)
local refresh = get_tag(html, "meta", {["http-equiv"]="^refresh$", content="^%d;%s*url="})
if not refresh then return end
local target = refresh.content:match("=['\"]?([^'\"]*)")
return target:find(stringaux.ipattern(criteria or "")) and target or nil
end
---
-- Extracts form input fields from a given HTML string
-- @param html a string representing HTML text
-- @param criteria a table of form attribute names and corresponding patterns,
-- for example {action="/login$"} to identify the appropriate
-- form. The patterns are treated as case-insensitive. If no
-- criteria are provided then the entire HTML string is treated
-- as the form inner HTML. (optional)
-- @return a table of form input fields, together with their values, if any
-- A fields without values are assigned empty strings, just as if they
-- were submitted
---
local function get_form_fields (html, criteria)
if html and criteria then
html = get_tag_html(html, "form", criteria)
end
if not html then return end
local form = stdnse.output_table()
for input in get_tags(html, "input", {name=""}) do
local type = (input.type or "text"):lower()
if type == "hidden" or type == "text" or type == "password" then
form[input.name] = input.value or ""
end
end
return form
end
---
-- Generates default scheme, host, and port components for a parsed URL.
--
-- This filter function generates the scheme, host, and port components from
-- the standard <code>host</code> and <code>port</code> script objects. These
-- components can then be passed onto function <code>url.build</code>.
--
-- As an example, the following code generates a URL for path "/test/"
-- on the current host and port:
-- <code>
-- local testurl = url.build(url_build_defaults(host, port, {path = "/test/"}))
-- </code>
-- or, alternatively, when not used as a filter:
-- <code>
-- local parsed = url_build_defaults(host, port)
-- parsed.path = "/test/"
-- local testurl = url.build(parsed)
-- </code>
--
-- @param host The host the URL is intended for.
-- @param port The port the URL is intended for.
-- @param parsed Parsed URL, as typically returned by <code>url.parse</code>,
-- or nil. The table can be be missing the scheme, host, and port
-- components. (optional)
-- @return A clone of the parsed URL, with any missing scheme, host, and port
-- components added.
-- @see url.parse
-- @see url.build
---
local function url_build_defaults (host, port, parsed)
local parts = tableaux.tcopy(parsed or {})
parts.host = parts.host or stdnse.get_hostname(host, port)
parts.scheme = parts.scheme or shortport.ssl(host, port) and "https" or "http"
if not parts.port and port.number ~= url.get_default_port(parts.scheme) then
parts.port = port.number
end
return parts
end
---
-- Encodes a string to make it safe for embedding into XML/HTML.
--
-- @param s The string to be encoded.
-- @return A string with unsafe characters encoded
---
local function xmlencode (s)
return (s:gsub("['\"`<>/\\=&]", function (c) return ("&#x%x;"):format(c:byte()) end))
end
---
-- Decodes an XML-encoded string.
--
-- @param s The string to be decoded.
-- @return A string with XML character references decoded
---
local function xmldecode (s)
local refmap = {amp = 0x26, quot = 0x22, apos = 0x27, lt = 0x3C, gt = 0x3E}
return (s:gsub("&(#?%w+);",
function (e)
local cp
if e:find("^#x%x+$") then
cp = tonumber(e:sub(3), 16)
elseif e:find("^#%d+$") then
cp = tonumber(e:sub(2))
else
cp = refmap[e]
end
return cp and cp <= 0xFF and string.char(cp)
end))
end
---
-- Performs URL encoding of all characters in a string.
--
-- @param s The string to be encoded.
-- @return A URL-encoded string
---
local function urlencode_all (s)
return (s:gsub(".", function (c) return ("%%%02X"):format(c:byte()) end))
end
---
-- Decodes a base64-encoded string safely, catching any decoding errors.
--
-- @param s The string to be decoded.
-- @return A decoded string or nil if the input is invalid
---
local function b64decode (s)
local status, out = pcall(base64.dec, s)
return status and out or nil
end
fingerprints = {}
---
--WEB
---
table.insert(fingerprints, {
name = "Ansible AWX",
cpe = "cpe:/a:ansible:tower",
category = "web",
paths = {
{path = "/api/"}
},
target_check = function (host, port, path, response)
if not (response.status == 200
and get_cookie(response, "csrftoken", "^%w+$")
and response.body
and response.body:find("AWX REST API", 1, true)) then
return false
end
local jstatus, jout = json.parse(response.body)
return jstatus and jout.description == "AWX REST API"
end,
login_combos = {
{username = "admin", password = "password"}
},
login_check = function (host, port, path, user, pass)
local resp1 = http_get_simple(host, port, path)
if resp1.status ~= 200 then return false end
local token = get_cookie(resp1, "csrftoken")
if not token then return false end
local form = {username=user,
password=pass,
next=path}
local header = {["X-CSRFToken"]=token}
local resp2 = http_post_simple(host, port, url.absolute(path, "login/"),
{cookies=resp1.cookies, header=header}, form)
return resp2.status == 302
and resp2.header["location"] == path
and get_cookie(resp2, "userLoggedIn") == "true"
end
})
table.insert(fingerprints, {
name = "Cacti",
cpe = "cpe:/a:cacti:cacti",
category = "web",
paths = {
{path = "/"},
{path = "/cacti/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and (get_cookie(response, "Cacti") or get_cookie(response, "CactiEZ"))
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local form = {action="login",
login_username=user,
login_password=pass}
local resp = http_post_simple(host, port, url.absolute(path, "index.php"),
nil, form)
return resp.status == 302
and (resp.header["location"] or ""):find("/", 1, true)
end
})
table.insert(fingerprints, {
name = "Zabbix",
cpe = "cpe:/a:zabbix:zabbix",
category = "web",
paths = {
{path = "/zabbix/"}
},
target_check = function (host, port, path, response)
return response.status == 200 and get_cookie(response, "zbx_sessionid")
end,
login_combos = {
{username = "admin", password = "zabbix"}
},
login_check = function (host, port, path, user, pass)
local form = {request="",
name=user,
password=pass,
enter="Sign in"}
local resp = http_post_simple(host, port, url.absolute(path, "index.php"),
nil, form)
return resp.status == 302 and resp.header["location"] == "dashboard.php"
end
})
table.insert(fingerprints, {
name = "Xplico",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 302 and get_cookie(response, "Xplico")
end,
login_combos = {
{username = "admin", password = "xplico"},
{username = "xplico", password = "xplico"}
},
login_check = function (host, port, path, user, pass)
local lurl = url.absolute(path, "users/login")
local resp1 = http_get_simple(host, port, lurl)
if resp1.status ~= 200 then return false end
local form = get_form_fields(resp1.body, {action="/users/login$"})
if not form then return false end
form["data[User][username]"] = user
form["data[User][password]"] = pass
local resp2 = http_post_simple(host, port, lurl,
{cookies=resp1.cookies}, form)
local loc = resp2.header["location"] or ""
return resp2.status == 302
and (loc:find("/admins$") or loc:find("/pols/index$"))
end
})
table.insert(fingerprints, {
name = "ExtraHop Web UI",
category = "web",
paths = {
{path = "/extrahop/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and response.body
and response.body:find("csrfmiddlewaretoken", 1, true)
and response.body:lower():find("<title>extrahop login", 1, true)
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local resp1 = http_get_simple(host, port, path)
if not (resp1.status == 200 and resp1.body) then return false end
local token = get_tag(resp1.body, "input", {type="^hidden$", name="^csrfmiddlewaretoken$", value=""})
if not token then return false end
local form = {[token.name]=token.value,
next=path,
username=user,
password=pass}
local header = {["Referer"]=url.build(url_build_defaults(host, port, {path=path}))}
local resp2 = http_post_simple(host, port, path,
{cookies=resp1.cookies, header=header}, form)
return resp2.status == 302
and (resp2.header["location"] or ""):sub(-#path) == path
end
})
table.insert(fingerprints, {
name = "Nagios",
cpe = "cpe:/a:nagios:nagios",
category = "web",
paths = {
{path = "/"},
{path = "/nagios/"}
},
target_check = function (host, port, path, response)
return http_auth_realm(response) == "Nagios Access"
end,
login_combos = {
{username = "nagiosadmin", password = "nagios"},
{username = "nagiosadmin", password = "nagiosadmin"},
{username = "nagiosadmin", password = "PASSW0RD"},
{username = "nagiosadmin", password = "CactiEZ"}
},
login_check = function (host, port, path, user, pass)
return try_http_auth(host, port, path, user, pass, false)
end
})
table.insert(fingerprints, {
name = "ManageEngine OpManager 10/11",
cpe = "cpe:/a:zohocorp:manageengine_opmanager",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
if not (response.status == 200
and response.body
and response.body:find("%Wwindow%.location%.href%s*=%s*(['\"])[^'\"]-/LoginPage%.do%1")) then
return false
end
local resp = http_get_simple(host, port, url.absolute(path, "LoginPage.do"))
return resp.status == 200
and resp.body
and resp.body:find("ManageEngine", 1, true)
and resp.body:lower():find("<title>%s*manageengine opmanager%s*</title>")
and get_tag(resp.body, "form", {action="/jsp/login%.do$"})
end,
login_combos = {
{username = "IntegrationUser", password = "plugin"},
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local resp1 = http_get_simple(host, port, url.absolute(path, "LoginPage.do"))
if resp1.status ~= 200 then return false end
local form2 = {clienttype="html",
isCookieADAuth="",
domainName="NULL",
authType="localUserLogin",
webstart="",
ScreenWidth=1024,
ScreenHeight=768,
loginFromCookieData="",
userName=user,
password=pass,
uname=""}
local resp2 = http_post_simple(host, port,
url.absolute(path, "jsp/Login.do"),
{cookies=resp1.cookies}, form2)
return (resp2.status == 200 or resp2.status == 302)
and get_cookie(resp2, "OPUTILSTICKET", "^%x+$")
end
})
table.insert(fingerprints, {
name = "ManageEngine OpManager 12",
cpe = "cpe:/a:zohocorp:manageengine_opmanager",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and response.body
and response.body:find("ManageEngine", 1, true)
and response.body:lower():find("<title>%s*manageengine opmanager%s*</title>")
and get_tag(response.body, "form", {action="^j_security_check%f[;\0]"})
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local resp1 = http_get_simple(host, port, path)
if resp1.status ~= 200 then return false end
local form2 = {AUTHRULE_NAME="Authenticator",
clienttype="html",
ScreenWidth=1024,
ScreenHeight=768,
loginFromCookieData="false",
ntlmv2="false",
j_username=user,
j_password=pass,
domainNameAD="Authenticator",
uname=""}
local resp2 = http_post_simple(host, port,
url.absolute(path, "j_security_check"),
{cookies=resp1.cookies}, form2)
return resp2.status == 303
and (resp2.header["location"] or ""):sub(-#path) == path
end
})
table.insert(fingerprints, {
name = "ntopng",
cpe = "cpe:/a:ntop:ntopng",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
local loc = response.header["location"] or ""
if not (response.status == 302
and loc:find("/lua/login.lua?referer=", 1, true)
and get_cookie(response, "session") == "") then
return false
end
local resp = http_get_simple(host, port, loc)
return resp.status == 200
and resp.body
and resp.body:find("ntopng", 1, true)
and resp.body:lower():find("<title>welcome to ntopng</title>", 1, true)
and get_tag(resp.body, "form", {action="/authorize%.html$"})
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local form = {user=user,
password=pass,
referer=host.name .. path}
local resp = http_post_simple(host, port,
url.absolute(path, "authorize.html"),
nil, form)
return resp.status == 302
and resp.header["location"] == path
and get_cookie(resp, "user") == user
end
})
table.insert(fingerprints, {
name = "OpenNMS",
cpe = "cpe:/a:opennms:opennms",
category = "web",
paths = {
{path = "/login.jsp"},
{path = "/opennms/login.jsp"}
},
target_check = function (host, port, path, response)
return response.status == 200
and response.body
and response.body:find("OpenNMS", 1, true)
and response.body:lower():find("<title>%s*opennms web console%s*</title>")
and get_tag(response.body, "input", {name="^j_username$"})
end,
login_combos = {
{username = "admin", password = "admin"},
{username = "rtc", password = "rtc"}
},
login_check = function (host, port, path, user, pass)
local form = {j_username=user,
j_password=pass,
j_usergroups="",
Login=""}
local resp = http_post_simple(host, port,
url.absolute(path, "j_spring_security_check"),
nil, form)
return resp.status == 302
and (resp.header["location"] or ""):find("/index%.jsp%f[?\0]")
end
})
table.insert(fingerprints, {
name = "SevOne NMS",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and get_cookie(response, "SEVONE")
and response.body
and response.body:lower():find("<title>sevone nms - network manager", 1, true)
end,
login_combos = {
{username = "Admin", password = "SevOne"},
{username = "SevOneStats", password = "n3v3rd13"}
},
login_check = function (host, port, path, user, pass)
local resp1 = http_get_simple(host, port, path)
if not (resp1.status == 200 and resp1.body) then return false end
local token = resp1.body:match("GlobalData%.Utilities%.Xsrf%.setToken%(%s*['\"](%x+)")
if not token then return false end
local form = {login=user,
passwd=pass,
browser="mozilla",
version=52,
tzString=os.date("!%a %b %d %Y %H:%M:%S GMT+0000"),
check_tz=0}
local refpath = url.absolute(path, "doms/login/index.php")
local header = {["Referer"]=url.build(url_build_defaults(host, port, {path=refpath})),
["X-CSRFToken"]=token}
local resp2 = http_post_simple(host, port,
url.absolute(refpath, "processLogin.php"),
{cookies=resp1.cookies, header=header}, form)
if not (resp2.status == 200 and resp2.body) then return false end
local jstatus, jout = json.parse(resp2.body)
return jstatus and (jout.status == 0 or jout.status == -3)
end
})
table.insert(fingerprints, {
name = "Device42 Appliance Manager",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 302 and get_cookie(response, "d42amid")
end,
login_combos = {
{username = "d42admin", password = "default"}
},
login_check = function (host, port, path, user, pass)
local lurl = url.absolute(path, "accounts/login/")
local resp1 = http_get_simple(host, port, lurl .. "?next=" .. path)
if not (resp1.status == 200 and resp1.body) then return false end
local form = {csrfmiddlewaretoken=get_cookie(resp1, "d42amid_csrftoken"),
username=user,
password=pass,
next=path}
local header = {["Referer"]=url.build(url_build_defaults(host, port, {path=lurl}))}
local resp2 = http_post_simple(host, port, lurl,
{cookies=resp1.cookies, header=header}, form)
return resp2.status == 302
and (resp2.header["location"] or ""):sub(-#path) == path
end
})
table.insert(fingerprints, {
name = "Grafana",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 302 and get_cookie(response, "grafana_sess")
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local header = {["Accept"]="application/json, text/plain, */*",
["Content-Type"]="application/json;charset=utf-8"}
local jin = {user=user, email="", password=pass}
json.make_object(jin)
local resp = http_post_simple(host, port, url.absolute(path, "login"),
{header=header}, json.generate(jin))
return resp.status == 200 and get_cookie(resp, "grafana_user") == user
end
})
table.insert(fingerprints, {
name = "Apache Ambari",
cpe = "cpe:/a:apache:ambari",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and response.body
and response.body:find(">Ambari<", 1, true)
and response.body:lower():find("<title>ambari</title>", 1, true)
and get_tag(response.body, "script", {src="^javascripts/app%.js$"})
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
return try_http_auth(host, port, url.absolute(path, "api/v1/users/admin"),
user, pass, false)
end
})
table.insert(fingerprints, {
name = "Cloudera Manager",
cpe = "cpe:/a:cloudera:cloudera_manager",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and get_cookie(response, "CLOUDERA_MANAGER_SESSIONID")
end,
login_combos = {
{username = "admin", password = "admin"}
},
login_check = function (host, port, path, user, pass)
local form = {j_username=user,
j_password=pass,
returnUrl="",
submit=""}
local resp = http_post_simple(host, port,
url.absolute(path, "j_spring_security_check"),
nil, form)
return resp.status == 302
and (resp.header["location"] or ""):find("/cmf/postLogin%f[?\0]")
end
})
table.insert(fingerprints, {
name = "OpenDaylight",
cpe = "cpe:/a:opendaylight:opendaylight",
category = "web",
paths = {
{path = "/"}
},
target_check = function (host, port, path, response)
return response.status == 200
and get_cookie(response, "JSESSIONID", "^%x+$")
and response.body
and response.body:find("OpenDaylight", 1, true)
and response.body:lower():find("<title>opendaylight ", 1, true)
and get_tag(response.body, "form", {action="^j_security_check%f[;\0]"})
end,
login_combos = {
{username = "admin", password = "admin"}