Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Resource decoding error. #2863

Closed
Anonymous2716 opened this issue Aug 7, 2022 · 4 comments
Closed

[BUG] Resource decoding error. #2863

Anonymous2716 opened this issue Aug 7, 2022 · 4 comments

Comments

@Anonymous2716
Copy link

Information

  1. Apktool Version (apktool -version) - 2.6.1
  2. Operating System (Mac, Linux, Windows) - Windows / Linux
  3. APK From? (Playstore, ROM, Other) - vmos.com

Stacktrace/Logcat

❯ apktool d base.apk -v -f --no-src
Aug 07, 2022 10:34:23 PM brut.androlib.ApkDecoder decode
INFO: Using Apktool 2.6.1-dirty on base.apk
Aug 07, 2022 10:34:24 PM brut.androlib.res.AndrolibResources loadMainPkg
INFO: Loading resource table...
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:24 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:25 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Aug 07, 2022 10:34:26 PM brut.androlib.res.AndrolibResources decodeManifestWithResources
INFO: Decoding AndroidManifest.xml with resources...
Exception in thread "main" brut.androlib.err.RawXmlEncounteredException: Could not decode XML
        at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:145)
        at brut.androlib.res.decoder.XmlPullStreamDecoder.decodeManifest(XmlPullStreamDecoder.java:151)
        at brut.androlib.res.decoder.ResFileDecoder.decodeManifest(ResFileDecoder.java:159)
        at brut.androlib.res.AndrolibResources.decodeManifestWithResources(AndrolibResources.java:193)
        at brut.androlib.Androlib.decodeManifestWithResources(Androlib.java:141)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:109)
        at brut.apktool.Main.cmdDecode(Main.java:175)
        at brut.apktool.Main.main(Main.java:79)
Caused by: java.io.IOException: Invalid chunk type (1310976).
        at brut.androlib.res.decoder.AXmlResourceParser.doNext(AXmlResourceParser.java:856)
        at brut.androlib.res.decoder.AXmlResourceParser.next(AXmlResourceParser.java:98)
        at brut.androlib.res.decoder.AXmlResourceParser.nextToken(AXmlResourceParser.java:108)
        at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.nextToken(XmlPullParserDelegate.java:105)
        at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:138)
        ... 7 more

APK

https://files.vmos.cn/vmospro/version/2022021911283769073_Overseas.apk

It happens only on resource decoding . with --no-res it decodes fine.

@iBotPeaches
Copy link
Owner

Odd. I replicate, but this is such a low level issue that suggests a new XML node type.

@parkerlreed
Copy link

Also seen here #2587

Seems VMOS may be obfuscating their XML file?

@4ft35t
Copy link

4ft35t commented Apr 20, 2023

Same issue

I: Using Apktool 2.7.0 on Env145-Vip.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
Exception in thread "main" brut.androlib.err.RawXmlEncounteredException: Could not decode XML
	at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:145)
	at brut.androlib.res.decoder.XmlPullStreamDecoder.decodeManifest(XmlPullStreamDecoder.java:151)
	at brut.androlib.res.decoder.ResFileDecoder.decodeManifest(ResFileDecoder.java:164)
	at brut.androlib.res.AndrolibResources.decodeManifestWithResources(AndrolibResources.java:196)
	at brut.androlib.Androlib.decodeManifestWithResources(Androlib.java:145)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:109)
	at brut.apktool.Main.cmdDecode(Main.java:175)
	at brut.apktool.Main.main(Main.java:79)
Caused by: java.io.IOException: Expected: 0x00080003 or 0x00080001, got: 0x0008b800
	at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:45)
	at brut.androlib.res.decoder.AXmlResourceParser.doNext(AXmlResourceParser.java:834)
	at brut.androlib.res.decoder.AXmlResourceParser.next(AXmlResourceParser.java:98)
	at brut.androlib.res.decoder.AXmlResourceParser.nextToken(AXmlResourceParser.java:108)
	at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.nextToken(XmlPullParserDelegate.java:105)
	at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:138)
	... 7 more

apk

https://drive.google.com/file/d/1RqHKPlc_lQSQpgC5o8zU4p1ErWdM-eNQ/view

7z pass: apktool

@iBotPeaches
Copy link
Owner

For the original issue - the decoding works now after

➜  2863 apktool d 2863.apk -s -f
I: Using Apktool 2.8.2-22eb80-SNAPSHOT on 2863.apk
I: Loading resource table...
I: Decoding file-resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Decoding values */* XMLs...
I: Decoding AndroidManifest.xml with resources...
W: AXML header larger than 0x10 bytes, skipping 4 bytes.
I: Regular manifest package...
I: Copying raw classes.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜  2863

This was fixed during merge of: #3210. It looks like decoding is the goal here as rebuilding with this malformed attributes is another effort, but at least for static analysis you can review application without Apktool crashing.

I'll make a new issue for comment here: #2863 (comment) as it continues to crash and is unrelated to this technique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants