Skip to content

[bug] objection cannot patch the AndroidManifest.xml #758

@Diolor

Description

@Diolor

Describe the bug
It seems objection cannot patch the AndroidManifest.xml.

To Reproduce
I have tried to use OWASP technique 26 towards an emulator.

Similar issues
N/A

Expected behavior
Patch the Manifest with INTERNET permission.

Evidence / Logs / Screenshots

An error may have occurred while extracting the APK.
Invalid arguments.

App does not have android.permission.INTERNET, attempting to patch the AndroidManifest.xml...
Traceback (most recent call last):
  File "/Users/dionysislorentzos/.local/bin/objection", line 7, in <module>
    sys.exit(cli())
             ~~~^^
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/click/core.py", line 1462, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/click/core.py", line 1383, in main
    rv = self.invoke(ctx)
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/click/core.py", line 1850, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/click/core.py", line 1246, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/click/core.py", line 814, in invoke
    return callback(*args, **kwargs)
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/objection/console/cli.py", line 373, in patchapk
    patch_android_apk(**locals())
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/objection/commands/mobile_packages.py", line 192, in patch_android_apk
    patcher.inject_internet_permission()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/objection/utils/patchers/android.py", line 435, in inject_internet_permission
    xml = self._get_android_manifest()
  File "/Users/dionysislorentzos/.local/pipx/venvs/objection/lib/python3.13/site-packages/objection/utils/patchers/android.py", line 296, in _get_android_manifest
    return ElementTree.parse(os.path.join(self.apk_temp_directory, 'AndroidManifest.xml'))
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xml/etree/ElementTree.py", line 1210, in parse
    tree.parse(source, parser)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/xml/etree/ElementTree.py", line 562, in parse
    source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/qv/n2ckbdtx0491236x6dms4mrm0000gn/T/tmp87teyrb3.apktemp/AndroidManifest.xml'
Cleaning up temp files...
~

Environment (please complete the following information):

  • Device: Mac OS 15.6.1 with Apple Silicon
  • Objection Version: 1.11.0 (installed via pipx)
  • Python 3.13 (aka python3 + pip3 installed via brew)

Application
If possible, please attach the target application where you can reproduce this bug to the issue.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    freshissueDefault label for new, untriaged issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions