我查查 6.6 去校验分析

其实我是不用这个软件的,不过受烈火之托,就看了看这个校验,据说在.so文件中。

首先呢,用VTS打开apk文件,经过初步分析,判断是否被修改全部根据下面这个位于com/wochacha/datacenter/DataProvider中的函数的返回值

.method private native init()I
.end method

这是个native函数,所以确实是在.so文件中的。 经过搜索,发现libe.so文件中Java_com_wochacha_datacenter_DataProvider_init函数,果断IDA打开libe.so。

EXPORT Java_com_wochacha_datacenter_DataProvider_init
Java_com_wochacha_datacenter_DataProvider_init
PUSH    {R4,LR}
BL      _Z9checkSignP7_JNIEnvP8_jobject ; checkSign(_JNIEnv *,_jobject *)
POP     {R4,PC}
; End of function Java_com_wochacha_datacenter_DataProvider_init

这个函数直接跳转到checkSign(_JNIEnv *,_jobject *)函数,这个函数名敢再直白一点吗?

稍微看了一下,这个checkSign函数,就只是先是检查了一下com/wochacha/util/WccConstant的DEBUG常量,然后计算并对比了一下apk签名的MD5,并没有什么特殊操作。

本着一切从简的原则,能不改.so就不改.so。

于是回到DataProvider.smali,搜索了一下init()I这个函数只在这一个地方被调用了,于是干脆把调用函数以及判断返回结果的代码全部注释掉,让他直接把1写入initResult:Z。

修改之后代码如下:

#.line 108
#invoke-direct {p0}, Lcom/wochacha/datacenter/DataProvider;->init()I

#move-result v0

#.line 109
#if-nez v0, :cond_29

#.line 110
#const/4 v0, 0x0

#iput-boolean v0, p0, Lcom/wochacha/datacenter/DataProvider;->initResult:Z

#.line 113
#:goto_28
#return-void

#.line 112
#:cond_29
iput-boolean v1, p0, Lcom/wochacha/datacenter/DataProvider;->initResult:Z
return-void
#goto :goto_28

重新编译,测试一下,本来以为没什么问题了,可惜后来发现不管扫什么条形码都说没有收录。

果然没这么简单,搜索PackageManager,发现libgcbarcode_j.so里面居然有,嗯,很可疑,IDA之。

找到Gc_func_ab函数,果然有校验,不过貌似只是对比了一下包名和软件名,不过管它呢,虽然我不需要改动这些,但是既然见到了校验怎么能不去掉呢。

所有的几个对比失败了都会跳转到这里。

MOV     R0, #0
LDMFD   SP!, {R3-R11,PC}

#0改成#1即可。

只好继续找了,我又尝试搜索了几个常见的关键词,都没有什么收获。那就只好从问题入手分析了。

首先找到显示条形码没有收录的界面的函数是com/wochacha/compare/CommodityCompareResultActivity的showInValidInfo(Ljava/lang/String;)V。

会调用这个函数是因为barcodeErrorType:Ljava/lang/String;是255,这个变量的值是从Lcom/wochacha/datacenter/BarcodeInfo;->ErrorType:Ljava/lang/String;得到的,而唯一修改ErrorType的函数就是BarcodeInfo中的setErrorType(Ljava/lang/String;)V。

经过搜索,又回到了DataProvider.smali。分析发现这个错误代码来自一个json数据,而这个json是从网络获取的。此时我有点绝望,但仔细分析构建url的代码后,发现url中的barcode参数实际上是加了密的,并且还有一个参数是b_en就是用来加密的,把它也传给服务器说明也可以用它来解密。这时思路顿时清晰了,下面来看看加密过程吧。

这里必须要插一句,看了这个url的参数我算是体会到这款软件是有多么流氓了,完全没有考虑用户隐私,就一个查询条形码的请求,参数中居然包括了UDID(就是你的IMEI),MAC地址,连接方式(wifi或者3G), 最恐怖的是,如果定位信息可用的话还会把GPS的经纬度坐标也发给服务器。

回到barcode加密,实际调用的是Lcom/wochacha/datacenter/DataProvider;->convertData([BII)Ljava/lang/String;函数。看到函数的原型我笑了。

.method private native convertData([BII)Ljava/lang/String;
.end method

果然又是native啊(喂喂不是naive啊看清楚你想什么呢)。搜索显示这个函数也在libe.so,可是这个文件很小,总共也只有不到十个函数,如果有这个函数我之前怎么会没看到呢?再次打开IDA,果然函数列表中没有这个函数,看上去应该是IDA的bug。

看了半天convertData,实际上关键部分不在这里,而是在wcc_encode函数,这个函数之前我也有看到,但是没有找到任何地方会调用这个函数(都怪IDA),于是也没注意。

wcc_encode

这回仔细看一下,函数开头读取了内存中的一个值,和1比较,之后会有两种不同的encode算法,这两种算法绝大部分都一样,只是其中一个算法在某一步读取内存时多加了个0xC的偏移。

再看了看,之前比较的那个值貌似就是checkSign函数最后保存的。于是我修改了几个指令让checkSign函数所有情况都会返回并且保存1。

测试一下,居然还是不行!才想起来最开始的修改直接把调用init()I的代码注释掉了,导致checkSign函数根本没运行,从而也无法将1保存到内存中。

这次把最开始的修改恢复成原始的样子,打包,测试。

终于没问题了,剩下的去广告之类的工作就交给烈火吧。

写这篇文章也算是让自己记住这次教训,本来很容易的一件事,绕了一大圈最后还是回到原地解决。

您可能还喜欢...

67 条回复

  1. 发的发的说道:
    Google Chrome 30.0.1599.101 Google Chrome 30.0.1599.101 Windows 7 x64 Edition Windows 7 x64 Edition

    哈哈哈

  2. o01w10o说道:
    Google Chrome 32.0.1700.76 Google Chrome 32.0.1700.76 Windows 7 Windows 7

    不明觉厉,作者辛苦了~

  3. Misuzu说道:
    Google Chrome 32.0.1700.102 Google Chrome 32.0.1700.102 Windows 7 Windows 7

    (╭☞•́∀•̀)╭☞知道乃有多辛苦,摸摸头~

  4. 叶子说道:
    Google Chrome 32.0.1700.76 Google Chrome 32.0.1700.76 Windows 8.1 Windows 8.1

    跪求更新qq5.0,j大

  5. 清爽说道:
    Firefox 25.0 Firefox 25.0 Windows 8.1 Windows 8.1

    高手!不过话说Jayxon老大怎么放弃更新QQ了?导致网上有一个人牛哄哄的,觉得他修改的QQ好,我呸~

  6. jiechic说道:
    Firefox 26.0 Firefox 26.0 Windows 7 x64 Edition Windows 7 x64 Edition

    不明觉厉啊,,,,好厉害的样子。

  7. thinkme说道:
    Google Chrome 32.0.1700.76 Google Chrome 32.0.1700.76 Windows 7 x64 Edition Windows 7 x64 Edition

    不明觉厉

  8. 皓月说道:
    Google Chrome 31.0.1650.63 Google Chrome 31.0.1650.63 Windows 7 x64 Edition Windows 7 x64 Edition

    依旧是 不明觉厉!!
    大拇哥 树一个!

  9. 云飞说道:
    Google Chrome 32.0.1700.76 Google Chrome 32.0.1700.76 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    不明觉厉……

  10. S7说道:
    TheWorld Browser TheWorld Browser Windows XP Windows XP

    J大的软件好顶赞!每天必定会上来看看有没有更新!

  11. 2014说道:
    Chrome 32.0.1700.20 Chrome 32.0.1700.20 iPad iOS 7.1 iPad iOS 7.1

    说好的QQ呢,说好的迅雷呢?新年快乐,马上有钱,马上有绿软

  12. awi说道:
    Google Chrome 34.0.1817.4 Google Chrome 34.0.1817.4 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    J大 新年快乐 !

    新年第一遍博文 还是技术文档 大赞

  13. lytion说道:
    Google Chrome 32.0.1700.102 Google Chrome 32.0.1700.102 Windows 7 x64 Edition Windows 7 x64 Edition

    国产软件流氓本色啊,还好我尽量都是外国软件全英文。。。原来J大和烈火大大都认识。。。等大大的迅雷更新

  14. 我是在说道:
    IEMobile 10.0 IEMobile 10.0 Windows Phone 8 Windows Phone 8

    看浏览器

  15. 山城子说道:
    Google Chrome 32.0.1700.76 Google Chrome 32.0.1700.76 Windows XP Windows XP

    博主辛苦了!喜欢用您制作的绿色软件。祝您新年快乐,平安吉祥!

  16. 胡说君说道:
    Firefox 29.0 Firefox 29.0 Windows 7 Windows 7

    跪求j大简单做个最新迅雷vip版精简,现在的其他版本或多或少都有点问题。。

  17. 川贝说道:
    Firefox 26.0 Firefox 26.0 Windows 7 x64 Edition Windows 7 x64 Edition

    博主是否能更新下迅雷 之前的迅雷Thunder 7.2.13.3884 JayXon绿色精简版 一直使用很不错 谢谢

  18. 神仙说道:
    Firefox 26.0 Firefox 26.0 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    正常,不能说容易,你不到最后折腾这么久,也不会想到checkSign里面改了一个值影响到别的地方。

  19. jayxon zd fans说道:
    QQbrowser 7.5.16545.400 QQbrowser 7.5.16545.400 Windows XP Windows XP

    不明觉厉,盼老大新作品

  20. 见异思马迁说道:
    Firefox 26.0 Firefox 26.0 Ubuntu Ubuntu

    好好,又学习了一下分析思路,支持这样的心得分享!

  21. 昵称 (必填)说道:
    Maxthon 0.9.0.21 Maxthon 0.9.0.21 GNU/Linux x64 GNU/Linux x64

    我查查 6.6 去校验分析

  22. 乐乐唱唱歌说道:
    Google Chrome 30.0.1599.101 Google Chrome 30.0.1599.101 Windows 7 Windows 7

    大神就是大神啊。等待烈火出APP

  23. tomcat说道:
    Internet Explorer 11.0 Internet Explorer 11.0 Windows 7 x64 Edition Windows 7 x64 Edition

    膜拜大牛,能不能改一个发送虚假UDID,MAC的版本?

  24. 有道理说道:
    Google Chrome 34.0.1788.0 Google Chrome 34.0.1788.0 Mac OS X  10.9.1 Mac OS X 10.9.1

    这垃圾软件早就删了。

  25. 吴远说道:
    Google Chrome 32.0.1700.107 Google Chrome 32.0.1700.107 Windows 7 Windows 7

    好棒

  26. TTZKA说道:
    Internet Explorer 10.0 Internet Explorer 10.0 Windows 7 x64 Edition Windows 7 x64 Edition

    烈火大神他为什么不怕查水表

  27. 1说道:
    Internet Explorer 12.0 Internet Explorer 12.0 Mac OS X  11.9.3 Mac OS X 11.9.3

    rhrhsf

  28. 1说道:
    Firefox 27.0.1 Firefox 27.0.1 Mac OS X  11.9.3 Mac OS X 11.9.3

    手机软件也越来越多广告了

  29. Kylin说道:
    Google Chrome 32.0.1700.107 Google Chrome 32.0.1700.107 Windows 7 x64 Edition Windows 7 x64 Edition

    求问那个wordpress的代码插件是叫什么名字?

  30. 昵称 (必填)说道:
    Internet Explorer 11.0 Internet Explorer 11.0 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    ssssssssssssssssssss

  31. yyy说道:
    Android Webkit 4.0 Android Webkit 4.0 Android 4.0.4 Android 4.0.4

    ghddgghc

  32. lordlk说道:
    Google Chrome 34.0.1838.2 Google Chrome 34.0.1838.2 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    学习了。

  33. zZ说道:
    Google Chrome 30.0.1599.101 Google Chrome 30.0.1599.101 Windows 7 Windows 7

    我觉得我查查还行吧,二维码的数据比灵动快拍丰富多了,就是广告有点多

  34. 晨星说道:
    Internet Explorer 6.0 Internet Explorer 6.0 Windows XP Windows XP

    老大 什么时候把迅雷更新下哈 望眼欲穿啊

  35. velatne说道:
    Firefox 27.0 Firefox 27.0 Windows XP Windows XP

    J兄威武啊,话说迅雷好久没见你更新了,有查水表的?

  36. 天爵说道:
    Maxthon 4.2.0.4000 Maxthon 4.2.0.4000 Windows XP Windows XP

    好久不更新了,我还以为你弃了呢

  37. 枫树说道:
    Maxthon 4.3.0.1000 Maxthon 4.3.0.1000 Windows 7 x64 Edition Windows 7 x64 Edition

    换浏览器了

  38. speedin说道:
    Firefox 27.0 Firefox 27.0 Windows 7 Windows 7

    看看浏览器

  39. momognu说道:
    Firefox 27.0 Firefox 27.0 GNU/Linux GNU/Linux

    你们分工还真明确,我用过qq2010jayxon

  40. lovedoen说道:
    Maxthon 4.3.1.1000 Maxthon 4.3.1.1000 Windows 7 Windows 7

    请问J大,烈火是谁?是汉化winrar的那个?

  41. 0.0说道:
    Google Chrome 33.0.1750.117 Google Chrome 33.0.1750.117 Windows 7 x64 Edition Windows 7 x64 Edition

    J大再不更新我要查你水表

  42. 大冰说道:
    Google Chrome 31.0.1650.63 Google Chrome 31.0.1650.63 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    这代码字体是comic sans吗/..为毛在我的IDE上面显示比这个丑多了~

  43. 烦躁熊说道:
    Google Chrome 12.0.707.0 Google Chrome 12.0.707.0 Windows 7 x64 Edition Windows 7 x64 Edition

    请问J大大的QQ2013精简版什么时候出新的啊?

  44. 东方商厦说道:
    Internet Explorer 11.0 Internet Explorer 11.0 Windows 7 x64 Edition Windows 7 x64 Edition

    请问J大大的QQ2013精简版什么时候出新的啊?

  45. hety说道:
    Google Chrome 33.0.1750.146 Google Chrome 33.0.1750.146 Windows 7 x64 Edition Windows 7 x64 Edition

    楼主厉害啊,与时俱进,用你的迅雷用了好久了,现在又研究安卓这块了

  46. 呵呵哈说道:
    Firefox 27.0 Firefox 27.0 Windows 7 Windows 7

    求J大更新一下QQ2014版本,2013问题太多了,12和11版现在又被封。

  47. 一直支持J大说道:
    Firefox 24.0 Firefox 24.0 Windows 7 x64 Edition Windows 7 x64 Edition

    烈火开始弄APK了啊,期待啊

  48. 昵称 (必填)说道:
    Google Chrome 18.0.1025.166 Google Chrome 18.0.1025.166 Windows 8 Windows 8

    test

  49. 昵称 (必填)说道:
    Google Chrome 99 Google Chrome 99 Windows 95 Windows 95

    test2

  50. Google Chrome 33.0.1750.154 Google Chrome 33.0.1750.154 Windows 8 x64 Edition Windows 8 x64 Edition

    楼主厉害,逆向工程

  51. abc说道:
    Google Chrome 35.0.1916.14 Google Chrome 35.0.1916.14 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    给力啊,技术达人。

  52. aptx说道:
    Google Chrome 21.0.1180.89 Google Chrome 21.0.1180.89 Windows 7 x64 Edition Windows 7 x64 Edition

    技术狂人

  53. Eric说道:
    UC Browser 6.x UC Browser 6.x Windows 8 x64 Edition Windows 8 x64 Edition

    大/神能告诉我我查查这个应用输入条码后提交的查询地址是多少?wochacha/scan/+输入的条码吗?

  54. pjfan说道:
    Google Chrome 36.0.1985.143 Google Chrome 36.0.1985.143 Windows 7 x64 Edition Windows 7 x64 Edition

    能告诉下你这个思维导图是用什么软件做的吗?

  55. ua说道:
    Safari 3.0 Safari 3.0 iPhone iPhone

    我来看看UA

  56. Esfunc说道:
    Google Chrome 38.0.2125.122 Google Chrome 38.0.2125.122 Windows 7 x64 Edition Windows 7 x64 Edition

    烈火是谁

发表评论

您的电子邮箱地址不会被公开。