摘要: 如何自动化检测海康威视设备弱口令?
本文作者:DMZLab,本文提供的方法仅供安全学习和教学用途,禁止非法使用
黑客如果想要入侵每一台互联网设备,知道IP是非常必要的。攻击者可以通过和客服打电话和自己在网上搜索等手段获取,有3种方法可取。
1.用专业的海康威视设备搜索工具。比如:iVMS-4200 客户端。
2.也是通过安装海康威视设备搜索工具如:iVMS-4200 客户端。然后设备和安装搜索工具的电脑连接。
3.客服说:所有海康威视的默认连接端口都是8000.利用nmap 扫内网。
给客服打电话收集信息是一个非常不错的选择,以上3个方法我一一尝试:
第一种方法:失败。(因为我要入侵的设备和我不在一个局域网)
第二种方法:需要和设备0距离接触失败。
第三种方法:成功。
接下来就演示我如何自动化检测海康威视设备的。
nmap 扫整个内网开8000的机器,然后逐一试探。因为8000端口是每个海康设备都会开启的。默认情况下,开启了8000端口,80端口也会开。
nmap -sS -T5 -p8000 -v -open -sV -oN c:\scan.txt 172.16.0.0/16
这么多开8000端口的机器,我一个一个的在网页上试:
试的我好费劲.
我就想先把开放8000端口的机器都过滤出来,我就拿powershell 写了一下。
[cmdletbinding()]
param
(
[parameter(Mandatory = $true)]
[Alias('f', 'file')]
[string]$filename,
[parameter(Mandatory = $true)]
[Alias('o', 'output')]
[string]$outputname
)
switch -regex (Get-Content $filename)
{ "(^Nmap scan report for )\b(.*)" { $matches[2] | Out-File -FilePath $outputname -Append}
}
保存为: grepnmap.ps1.
然后过滤ip.这个脚本不仅适合这个项目,其他关于nmap过滤ip都可以用 。
注意:此时过滤出来的数据不能直接-iL 这样使用.需要把IP重新复制到另一个txt中,nmap才能使用-iL参数。
把该脚本保存为test_jiankong.nse.放到nmap目录下的scripts目录下。
采用命令:
-- The Head Section --
description = [[Sample script to detect a fictional vulnerability in a fictional ArcticFission 1.0 web server
@usage
nmap --script http-vuln-check <target>
@output
PORT STATE SERVICE 80/tcp open http
|_http-vuln-check_packaging: Vulnerable
| VULNERABLE
| ArcticFission 1.0 Vulnerability
| State: VULNERABLE
| IDs: CVE:CVE-XXXX-XX
| References:
|_ http://dmzlab.com
author = "iphelix" license = "Same as Nmap -- See http://nmap.org/book/man-legal.html" categories = {"default", "safe"}
]]
-- The Rule Section -- local shortport = require "shortport" local http = require "http" local vulns = require "vulns" portrule = shortport.http
-- The Action Section --
action = function(host, port)
-- 漏洞定义部分 --
local vuln = {
title = "<<<<HIKVISION VULNERABLE>>>>",
state = vulns.STATE.NOT_VULN,
IDS = { CVE = 'CVE-2016-521' }
} local report = vulns.Report:new(SCRIPT_NAME, host, port) local uri = "/doc/page/login.asp"
local options = {header={}}
options['header']['User-Agent'] = "Mozilla/5.0 (compatible; ArcticFission)"
local response = http.get(host, port, uri, options) if(response.status==200 or response.status==500) then
vuln.state=vulns.STATE.VULN else
vuln.state=vulns.STATE.NOT_VULN
end return report:make_output(vuln)
end
扫描刚刚过滤出来开8000端口的机器,是否有http://IP/doc/page/login.asp 页面。如果有提示如下:
过滤出有http://IP/doc/page/login.asp 页面的机器.
原文地址:https://www.freebuf.com/articles/terminal/104472.html