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

Can't decompile obfuscated APK #2162

Closed
cobafesbuk opened this issue Sep 3, 2019 · 5 comments
Closed

Can't decompile obfuscated APK #2162

cobafesbuk opened this issue Sep 3, 2019 · 5 comments
Labels

Comments

@cobafesbuk
Copy link

Information

  1. Apktool Version (apktool -version) - 2.4.0
  2. Operating System (Mac, Linux, Windows) - Windows 10 64 Bit
  3. APK From? (Playstore, ROM, Other) - Apkpure

Stacktrace/Logcat

I: Using Apktool 2.4.0 on apkname.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
S: WARNING: Could not write to (C:\Users\User\AppData\Local\apktool\framework), using C:\Users\User\AppData\Local\Temp\ instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
I: Loading resource table from file: C:\Users\User\AppData\Local\Temp\1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130315
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f1200f0
W: Could not decode attr value, using undecoded value instead: ns=android, name=icon, value=0x7f080837
W: Could not decode attr value, using undecoded value instead: ns=android, name=logo, value=0x7f080572
W: Could not decode attr value, using undecoded value instead: ns=android, name=networkSecurityConfig, value=0x7f150001
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130316
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f1200f0
W: Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x7f15000a
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130317
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f1200f0
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130315
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f1203ac
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f121574
W: Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x7f110076
W: Could not decode attr value, using undecoded value instead: ns=android, name=value, value=0x7f120773
W: Could not decode attr value, using undecoded value instead: ns=android, name=value, value=0x7f120772
W: Could not decode attr value, using undecoded value instead: ns=android, name=value, value=0x7f120771
W: Could not decode attr value, using undecoded value instead: ns=android, name=value, value=0x7f120774
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f121286
W: Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x7f150002
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130319
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f1212b6
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130319
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f121285
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130319
W: Could not decode attr value, using undecoded value instead: ns=android, name=label, value=0x7f12028d
W: Could not decode attr value, using undecoded value instead: ns=android, name=theme, value=0x7f130319
.
.
.
.
.
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginRight, value=0x7f070175
W: Could not decode attr value, using undecoded value instead: ns=app, name=srcCompat, value=0x7f0805b1
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginRight, value=0x7f070175
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginLeft, value=0x7f07018a
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginLeft, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginTop, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginRight, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=android, name=text, value=0x7f120c34
W: Could not decode attr value, using undecoded value instead: ns=, name=style, value=0x7f1300f7
W: Could not decode attr value, using undecoded value instead: ns=android, name=padding, value=0x7f070144
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginLeft, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginTop, value=0x7f07018a
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginRight, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=, name=style, value=0x7f13029b
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginLeft, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginTop, value=0x7f07018a
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginRight, value=0x7f07014f
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_marginBottom, value=0x7f07013d
W: Could not decode attr value, using undecoded value instead: ns=android, name=background, value=0x7f0801b9
W: Could not decode attr value, using undecoded value instead: ns=app, name=cardBackgroundColor, value=0x7f0602df
W: Could not decode attr value, using undecoded value instead: ns=app, name=cardCornerRadius, value=0x7f07018a
W: Could not decode attr value, using undecoded value instead: ns=android, name=padding, value=0x7f07018a
W: Could not decode attr value, using undecoded value instead: ns=android, name=layout_margin, value=0x7f07017a
W: Could not decode attr value, using undecoded value instead: ns=, name=style, value=0x7f13029b
W: Could not decode attr value, using undecoded value instead: ns=app, name=srcCompat, value=0x7f080693
I: Decoding values */* XMLs...
Can't find framework resources for package of id: 127. You must install proper framework files, see project website for more info.

Steps to Reproduce

  1. apktool d apkname.apk

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

APK

https://apkpure.com/id/tokopedia-seller-app/com.tokopedia.sellerapp

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Yes
  2. If you are trying to install a modified apk, did you resign it? Haven't tried, failed at decompile step
  3. Are you using the latest apktool version? Yes
@cobafesbuk
Copy link
Author

I don't know if my issue is related to #1874 or not

With verbose flag I see the same brut output

FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Sep 03, 2019 3:28:03 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Sep 03, 2019 3:28:03 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Sep 03, 2019 3:28:03 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
Sep 03, 2019 3:28:03 PM brut.androlib.res.decoder.ARSCDecoder readConfigFlags
FINE: Config flags size > 56, but exceeding bytes are all zero, so it should be ok.
.
.
.
.
Sep 03, 2019 3:28:16 PM brut.androlib.res.decoder.AXmlResourceParser getAttributeValue
WARNING: Could not decode attr value, using undecoded value instead: ns=app, name=srcCompat, value=0x7f08068c
brut.androlib.err.CantFindFrameworkResException
        at brut.androlib.res.AndrolibResources.getFrameworkApk(AndrolibResources.java:786)
        at brut.androlib.res.AndrolibResources.loadFrameworkPkg(AndrolibResources.java:116)
        at brut.androlib.res.data.ResTable.getPackage(ResTable.java:84)
        at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:67)
        at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:63)
        at brut.androlib.res.decoder.ResAttrDecoder.decode(ResAttrDecoder.java:39)
        at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(AXmlResourceParser.java:385)
        at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(XmlPullParserDelegate.java:69)
        at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
        at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
        at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:84)
        at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:142)
        at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:33)
        at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:141)
        at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:121)
        at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:258)
        at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:131)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:124)
        at brut.apktool.Main.cmdDecode(Main.java:167)
        at brut.apktool.Main.main(Main.java:76)

Sep 03, 2019 3:28:16 PM brut.androlib.res.AndrolibResources decode
INFO: Decoding values */* XMLs...
Can't find framework resources for package of id: 127. You must install proper framework files, see project website for more info.

@iBotPeaches
Copy link
Owner

Not sure on this yet, seems to be crashing out on internal resources which doesn't make much sense.

@cobafesbuk
Copy link
Author

Additional information: I can decompile it using jadx

@iBotPeaches
Copy link
Owner

I replicate. Adding Bug.

I: Using Apktool 2.4.2-f545c2-SNAPSHOT on Tokopedia Seller_v2.31.1_apkpure.com.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203

@iBotPeaches
Copy link
Owner

I'm closing as the original crash is now resolved (the invalid chunk type).

➜  2162 apktool d 2162.apk -s -f -o new                                                                                         
I: Using Apktool 2.8.2-22eb80-SNAPSHOT on 2162.apk
I: Loading resource table...
I: Decoding Shared Library (com.tokopedia.sellerapp.df_base_sellerapp), pkgId: 126
I: Decoding Shared Library (com.tokopedia.sellerapp.shop_score_sellerapp), pkgId: 125
I: Decoding Shared Library (com.tokopedia.sellerapp.df_base_sellerapp), pkgId: 126
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: Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x7d090000
I: Regular manifest package...
I: Copying raw classes.dex file...
I: Copying raw classes2.dex file...
I: Copying raw classes3.dex file...
I: Copying raw classes4.dex file...
I: Copying raw classes5.dex file...
I: Copying raw classes6.dex file...
I: Copying raw classes7.dex file...
I: Copying raw classes8.dex file...
I: Copying raw classes9.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜  2162

You can rebuild assuming you fix that one undecoded resource, which is the resource for the splits.

➜  2162 apktool b new --use-aapt2                          
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
I: Using Apktool 2.8.2-22eb80-SNAPSHOT
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk into: new/dist/2162.apk
➜  2162 

Which then becomes a known issue :/ - #2514

So I feel its safe to close this one now as the remaining issue is tracked elsewhere.

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

No branches or pull requests

2 participants