Apktool: Can't decompile Hangouts v26

Created on 14 Aug 2018  路  5Comments  路  Source: iBotPeaches/Apktool

Information

  1. 2.3.4-6231ed-SNAPSHOT
  2. Mac
  3. APK Mirror

Stacktrace/Logcat

I: Using Apktool 2.3.4-6231ed-SNAPSHOT on hangouts_old.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:53)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:741)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
    at brut.androlib.Androlib.getResTable(Androlib.java:68)
    at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:228)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
    at brut.apktool.Main.cmdDecode(Main.java:164)
    at brut.apktool.Main.main(Main.java:73)
Caused by: java.io.IOException: Expected: 0x00000008, got: 0x00000202
    at brut.util.ExtDataInput.skipCheckShort(ExtDataInput.java:56)
    at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:354)
    at brut.androlib.res.decoder.ARSCDecoder.readEntryData(ARSCDecoder.java:276)
    at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:252)
    at brut.androlib.res.decoder.ARSCDecoder.readTableTypeSpec(ARSCDecoder.java:175)
    at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:131)
    at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
    ... 8 more

Steps to Reproduce

  1. apktool d hangouts.apk

APK

https://www.apkmirror.com/apk/google-inc/hangouts/hangouts-26-0-205315597-release/hangouts-26-0-205315597-11-android-apk-download/

ARSC Bug

Most helpful comment

The crash is occurring reading the ResValue of a spec. The size is always 8, but this is 0x202 or more commonly known as the type for specs. Something is wrong for sure.

All 5 comments

Confirmed. Crash very early before we can even read the ResPackages

The crash is occurring reading the ResValue of a spec. The size is always 8, but this is 0x202 or more commonly known as the type for specs. Something is wrong for sure.

I'm also seeing a similar crash with Binance.

I: Using Apktool 2.3.4 on com.binance.dev-58.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:53)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:741)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
    at brut.androlib.Androlib.getResTable(Androlib.java:68)
    at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:228)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
    at brut.apktool.Main.cmdDecode(Main.java:164)
    at brut.apktool.Main.main(Main.java:73)
Caused by: java.io.IOException: Expected: 0x00000008, got: 0x00000003
    at brut.util.ExtDataInput.skipCheckShort(ExtDataInput.java:56)
    at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:354)
    at brut.androlib.res.decoder.ARSCDecoder.readEntryData(ARSCDecoder.java:276)
    at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:252)
    at brut.androlib.res.decoder.ARSCDecoder.readTableTypeSpec(ARSCDecoder.java:175)
    at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:131)
    at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
    ... 8 more

https://play.google.com/store/apps/details?id=com.binance.dev

Merging duplicates in here. This is basically a non-ordered spec, since 202 is a spec, but we aren't expecting that.

Having a similar issue with this APK and Apktool 2.5.0. Trace looks a bit different, though:

Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:53)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:790)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
    at brut.androlib.Androlib.getResTable(Androlib.java:66)
    at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:236)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
    at brut.apktool.Main.cmdDecode(Main.java:179)
    at brut.apktool.Main.main(Main.java:82)
Caused by: java.io.EOFException
    at com.google.common.io.LittleEndianDataInputStream.readAndCheckByte(LittleEndianDataInputStream.java:232)
    at com.google.common.io.LittleEndianDataInputStream.readUnsignedShort(LittleEndianDataInputStream.java:98)
    at com.google.common.io.LittleEndianDataInputStream.readShort(LittleEndianDataInputStream.java:191)
    at brut.util.DataInputDelegate.readShort(DataInputDelegate.java:49)
    at brut.androlib.res.decoder.ARSCDecoder.readEntryData(ARSCDecoder.java:269)
    at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:252)
    at brut.androlib.res.decoder.ARSCDecoder.readTableTypeSpec(ARSCDecoder.java:175)
    at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:131)
    at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
    ... 8 more

As you collect duplicates here, I decided to not create another one :wink:

Hint for those just interested in the smali code: apktool d -r <apkfile> works in this case and doesn't trigger the exception (as it skips the resource file altogether).

Was this page helpful?
0 / 5 - 0 ratings