tw4ld6 发表于 2024-10-3 06:35:44

看我怎么样破解一台自动售货机


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvoicgfPibbNnib190yporz42gLHAOVQ7AkZEecaGDUJJG8wpxv4G9iaMhgw/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">声明:本文仅限技术讨论,严禁用于任何<span style="color: black;">违法</span>用途</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">毫无疑问,自动售货机是非常受欢迎的东西,<span style="color: black;">咱们</span>总会从中购买获取<span style="color: black;">有些</span>小零食。早几年前,自动售货机只接受离线的硬币支付,之后,<span style="color: black;">亦</span>慢慢采用了普及的NFC技术功能。<span style="color: black;">倘若</span>我说起“COGES”售货<span style="color: black;">设备</span> (英国售货<span style="color: black;">设备</span>厂商),我想肯定会勾起<span style="color: black;">非常多</span>人的美好时光回忆。时光辗转,一<span style="color: black;">不留心</span>,有些事情就<span style="color: black;">出现</span>了<span style="color: black;">基本</span>性的变化,现如今,这<span style="color: black;">已然</span>是一个被网络万物互联的时代了。今天,我就来和<span style="color: black;">大众</span>分享一个,我是<span style="color: black;">怎样</span>黑掉一台自动售货机,反复实现充值和购买售货机中商品的事例。</strong></p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">事情起因</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">有一天,我厌烦了深入简出的无聊生活,打算回老家晒晒太阳<span style="color: black;">休憩</span><span style="color: black;">休憩</span>,临走前,我到了学校拜访一个大学教授。穿过走廊,老师提议,<span style="color: black;">咱们</span>去喝杯咖啡吧,于是,<span style="color: black;">咱们</span>来到了自动售货机旁。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">我说:我来吧,我有硬币。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">老师:等等,我<span style="color: black;">能够</span>用手机APP来支付,<span style="color: black;">这般</span>会便宜点。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">能够</span>看到,这是一台Argenta自动售货机,其APP支付方式是基于蓝牙和NFC功能的,啊,虚拟钱包<span style="color: black;">便是</span>好啊!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvIDfCFn4GfbRyPCcfUEvUQHQL6FfaJl5eTgbwrvX0m10fmQ7AlOIicFA/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">此时,我心里闪过的念头 - 我能把它黑掉吗???</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">白帽心声:<span style="color: black;">无</span>赏金就当做是一种鼓励吧。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">灰帽心声:就当做练练手吧。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">黑帽心声:来吧,<span style="color: black;">伙伴</span>,<span style="color: black;">咱们</span>去收拾一下那个东西,<span style="color: black;">这般</span>就很牛了!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">于是乎,我就决定改天就开黑。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">技术分析</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">某天,我把我的安卓手机设置开启了USB调试模式,<span style="color: black;">而后</span>从应用商店中下载了自动售货机APP,并把原始APP的apk文件转储到笔记本电脑中,用adb去调试分析:</p># adb pull /data/app/com.sitael.vending-1/base.apk ./Argenta.apk<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">用apktool对它进行反编译:</p># apktool d ./Argenta.apk ./Argenta<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">再用 jadx提取出其中的java源文件:</p># jadx ./Argenta.apk<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">AndroidManifest.xml<span style="color: black;">名单</span>文件是<span style="color: black;">每一个</span>Android程序中必须的文件,它是<span style="color: black;">全部</span>Android程序的全局描述文件,除了能声明程序中的Activities,Content Providers,Services,和Intent Receivers,还能指定应用的名<span style="color: black;">叫作</span>、<span style="color: black;">运用</span>的图标、<span style="color: black;">包括</span>的组件以及permissions和instrumentation(安全<span style="color: black;">掌控</span>和测试)。<span style="color: black;">这儿</span>,一<span style="color: black;">起始</span>,需要把AndroidManifest.xml文件中的调试属性更改为ture,之后才可在手机上进行调试,<span style="color: black;">亦</span><span style="color: black;">便是</span>往application&nbsp;标签中添加一行 android:debuggable=”true” 属性。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvKrMbtIGPS0MIXcg1KcX36QKczHH2sjbHSxQWEKicic3VQqhm6uPHkj0g/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">接下来, 重建apk文件:</p># apktool b ./Argenta<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">而后</span>用工具keytool来创建一个新的密钥:</p># keytool -genkey -v -keystore Argenta.keystore -alias Argenta -keyalg RSA -keysize 2048 -validity 10000<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">接着,<span style="color: black;">运用</span>该创建密钥,用jarsigner来对<span style="color: black;">全部</span>apk文件进行签名:</p># jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore Argenta.keystore Argenta.apk Argenta<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">再用工具zipalign来对apk程序文件进行优化</p># zipalign -v 4 Argenta.apk Argenta-signed.apk<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">最后,就<span style="color: black;">能够</span>安装这个重建好的apk文件了。</p># adb install ./Argenta-signed.apk<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">我在手机上安装运行了这个APP程序,并用工具logcat,<span style="color: black;">经过</span>包名对其程序日志进行过滤分析:</p># adb logcat --pid=`adb shell pidof -s com.sitael.vending`<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvLjiaCLq8muVFJxMnSrFTicPdDuPHib6erqjnnXRicrgCaUkzqbRFFSoURg/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"><span style="color: black;">然则</span>,没什么收获,我打算再从其源代码中<span style="color: black;">瞧瞧</span>能有什么线索。从AndroidManifest.xml文件中,我<span style="color: black;">发掘</span>了指向RushOrm的多个引用。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvakDibas5RdueKvcxF4h1SOLu3frqQBicWicUNPntaIicZ9fkb4nnz8mXcg/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"><span style="color: black;">因此</span>,<span style="color: black;">这儿</span><span style="color: black;">首要</span>我找的关键字<span style="color: black;">便是</span>db_name,从<span style="color: black;">这儿</span>我<span style="color: black;">发掘</span>了argenta.db的影子:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkv99gGabSfiaZo304Ne6anIjb7ysNP0DUR6k0AUiavtezj0UgYfSQnn8AQ/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">接下来,在手机中,我用工具Root Explorer继续来<span style="color: black;">瞧瞧</span>这个argenta.db,真的是存在的:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvVQKrpH8gGt1ma8ogKXczC8p6iab46EmBibp3xCrGWUNX8ov8B7q3HKyA/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">而后</span>,我用adb pull方式把手机中的这个文件拷贝到笔记本电脑中来分析:</p># adb pull /data/data/com.sitael.vending/databases/argenta.db ./db<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">并尝试用SQLite的数据库浏览工具SQLiteBrowser来打开这个db文件:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvDkFu8bxxNBT9HFWcvJdsSgwz9PmribtmvFR2JKic8EECoibPic0saAayaQ/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">哦,显然,它是有<span style="color: black;">秘码</span><span style="color: black;">守护</span>的,打不开。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvIha17yraheXCrntYHk6sRkSYou11iaqJFNwbsudibicUzRKVILicJva2wQ/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">逆向工程</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在源代码中,我分析了RushAndroidConfig.java:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvyu6Q2kM4D6oaymic1pUy6y3w41qsuFpWJHbj0kWptP0sQ1SaEzJW5Nw/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">从其中,我竟然<span style="color: black;">发掘</span>了配置数据库的<span style="color: black;">各样</span><span style="color: black;">办法</span>(method),<span style="color: black;">然则</span>,其中这个键值<span style="color: black;">导致</span>了我的<span style="color: black;">重视</span>:</p>this.encryptionKey = getDeviceId(context)<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">它的定义如下:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvmfnibU1LRLuyqOSwAxyLWZrEFTsy6h4H7E7wC0xPUy6j1csD85DHWiaA/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;">从上图信息中可知,<span style="color: black;">目的</span>APP程序<span style="color: black;">运用</span>了手机的IMEI串号<span style="color: black;">做为</span>了<span style="color: black;">以上</span>SQLite数据库argenta.db的加密密钥,<span style="color: black;">一般</span>的手机,在键盘上输入*#06#就可得本身串号。<span style="color: black;">那样</span>,<span style="color: black;">咱们</span>用手机串号来试试吧,<span style="color: black;">瞧瞧</span>能否能把数据库文件打开:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkv6QSMK8Z0v9pal7Aicq8oAsu5J8p69xNxicQG8LqwWQebUbGSjvrQCrZw/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">哇,真的<span style="color: black;">能够</span>啊:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvkFEUsw7uWvk4wHNeYjkGOiaUeoXjucgzr7cZuKFtNwRsNicjVtOMF5KQ/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">经过一番<span style="color: black;">检测</span>,我找到了UserWallets这个表:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvkRG6FvaJxN5BNXMyz5K6SmlWKm32oh5PCYeeicVvoeWPzXOfDHYZxgw/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">并对其中的walletCredit一栏做了修改,把它从0改为了5(5欧元):</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvCNOcoe2c2hl7ylUJZZ1A5ndLIfibhjyrmsGR985PFianUfx8vg3wSboQ/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">而后</span>,我再把这个数据库文件拷贝回手机APP中:</p># adb pull ./argenta.db /data/data/com.sitael.vending/databases/argenta.db<h2 style="color: black; text-align: left; margin-bottom: 10px;">破解验证</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">此时,YY一下,我的感觉就像游戏帝国时代(Age Of Empires)中的“罗宾汉”<span style="color: black;">同样</span>,<span style="color: black;">能够</span>随便<span style="color: black;">持有</span>1000枚金币。好吧,还是先来写个小程序吧,<span style="color: black;">经过</span>这个程序,<span style="color: black;">能够</span>快捷地对<span style="color: black;">目的</span>APP数据库进行转储/恢复/篡改:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/qq5rfBadR3ibUOaEX59QS58Bz9rIjpgkvRv31RaChScTHiauVLMVAxLVIzwkyAoa4pPDUqzJtAa6mH5WsoXwHmVg/640?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">接下来,<span style="color: black;">咱们</span>就带上手机,去自动售货机那试试看吧!呵呵,竟然成功地买了一瓶矿泉水,真的<span style="color: black;">能够</span>用其中的5块钱顺利地进行消费,还能反复消费<span style="color: black;">运用</span>!</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">https://www.youtube.com/watch?v=LfczO8_RfLA</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">总结</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">从APP账户中的0元,到之后破解APP数据库后,我<span style="color: black;">能够</span>进行以下操作:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改APP账户的金额</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">任意购买自动售货机中的东西</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">继续用余额购买</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">余额为0之后可重新更改余额</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">如此重复消费购买自动售货机中的商品</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在对<span style="color: black;">全部</span>APP源代码做了大概分析之后,我<span style="color: black;">发掘</span>其中的<span style="color: black;">非常多</span>代码都未做混淆编码,这<span style="color: black;">寓意</span>着,售货机厂商<span style="color: black;">无</span>采取很好的<span style="color: black;">办法</span>来对用户数据和应用程序安全实行<span style="color: black;">守护</span>。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">再三纠结 ,<span style="color: black;">一月</span>后,出于白帽的<span style="color: black;">心理</span>,我还是向售货机厂商报告了这个漏洞,我<span style="color: black;">亦</span>礼貌性地<span style="color: black;">意见</span><span style="color: black;">她们</span>抛弃当前的APP架构,从头<span style="color: black;">研发</span>一个更好、更安全的程序。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">*参考<span style="color: black;">源自</span>:hacknoon,clouds编译,转载请注明来自FreeBuf.COM</strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></p>




4zhvml8 发表于 2024-10-10 23:55:25

回顾历史,我们感慨万千;放眼未来,我们信心百倍。

1fy07h 发表于 2024-10-12 07:22:24

感谢你的精彩评论,为我的思绪打开了新的窗口。

7wu1wm0 发表于 5 天前

谷歌外贸网站优化技术。
页: [1]
查看完整版本: 看我怎么样破解一台自动售货机