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] can't rebuilt apk #673

Open
RanushMithila opened this issue Mar 25, 2024 · 1 comment
Open

[bug] can't rebuilt apk #673

RanushMithila opened this issue Mar 25, 2024 · 1 comment
Labels
freshissue Default label for new, untriaged issues.

Comments

@RanushMithila
Copy link

Describe the bug
I tried to patch an apk using objection tool but I got an error like this

Performing zipalign
Zipaligning the APK may have failed. Read the following output to determine if zipalign actually had an error:

/usr/bin/zipalign: symbol lookup error: /usr/bin/zipalign: undefined symbol: _ZN11zip_archive6WriterD2Ev

Zipalign completed
Signing new APK.
Signing the new APK may have failed.

Exception in thread "main" java.io.FileNotFoundException: /tmp/tmp3qgmu6by.apktemp.aligned.objection.apk (No such file or directory)
at java.base/java.io.RandomAccessFile.open0(Native Method)
at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:344)
at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:259)
at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:213)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:190)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:356)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:85)

Signed the new APK
Copying final apk from /tmp/tmp3qgmu6by.apktemp.aligned.objection.apk to o2.objection.apk in current directory...
Traceback (most recent call last):
File "/home/kali/androidVenv/bin/objection", line 8, in
sys.exit(cli())
^^^^^
File "/home/kali/androidVenv/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/androidVenv/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/kali/androidVenv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/androidVenv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/androidVenv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/androidVenv/lib/python3.11/site-packages/objection/console/cli.py", line 373, in patchapk
patch_android_apk(**locals())
File "/home/kali/androidVenv/lib/python3.11/site-packages/objection/commands/mobile_packages.py", line 230, in patch_android_apk
shutil.copyfile(patcher.get_patched_apk_path(), os.path.join(os.path.abspath('.'), destination))
File "/usr/lib/python3.11/shutil.py", line 256, in copyfile
with open(src, 'rb') as fsrc:
^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp3qgmu6by.apktemp.aligned.objection.apk'
Cleaning up temp files...

Evidence / Logs / Screenshots

Used Command

objection patchapk -s o2.apk

Environment (please complete the following information):

  • OS: kali
  • apktool version: Apktool 2.9.3
  • Frida Version: 16.2.1
  • Objection Version: 1.11.0
@RanushMithila RanushMithila added the freshissue Default label for new, untriaged issues. label Mar 25, 2024
@RanushMithila RanushMithila changed the title [bug] I tried to patch an apk using objection [bug] can't rebuilt apk Mar 25, 2024
@IPMegladon
Copy link
Collaborator

Appears to be an issue with zipalign itself. You can try to add --skip-resources and --ignore-nativelibs when patching the app. Also check your zipalign version
i.e. objection -d patchapk -s o2.apk --skip-resources --ignore-nativelibs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
freshissue Default label for new, untriaged issues.
Projects
None yet
Development

No branches or pull requests

2 participants