Package: androguard
Version: 3.4.0~a1-1
Severity: important

Dear Maintainer,

androguard fails to parse some valid APKs, failing with:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/androguard/core/bytecodes/apk.py", line 1556, in get_android_resources
    return self.arsc["resources.arsc"]
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'resources.arsc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hans/code/fdroid/server/tests/../fdroid", line 22, in <module>
    fdroidserver.__main__.main()
  File "/home/hans/code/fdroid/server/fdroidserver/__main__.py", line 230, in 
main
    raise e
  File "/home/hans/code/fdroid/server/fdroidserver/__main__.py", line 211, in 
main
    mod.main()
  File "/home/hans/code/fdroid/server/fdroidserver/update.py", line 2267, in 
main
    apks, cachechanged = process_apks(apkcache, repodirs[0], knownapks,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/update.py", line 1650, in process_apks
    (skip, apk, cachethis) = process_apk(apkcache, apkfilename, repodir, 
knownapks,
                             
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/update.py", line 1510, in process_apk
    apk = scan_apk(apkfile)
          ^^^^^^^^^^^^^^^^^
File "/home/hans/code/fdroid/server/fdroidserver/update.py", line 1249, in scan_apk
    scan_apk_androguard(apk, apk_file)
File "/home/hans/code/fdroid/server/fdroidserver/update.py", line 1337, in scan_apk_androguard
    arsc = apkobject.get_android_resources()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/androguard/core/bytecodes/apk.py", line 1562, in get_android_resources
    self.arsc["resources.arsc"] = ARSCParser(self.zip.read("resources.arsc"))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/androguard/core/bytecodes/axml/__init__.py", line 1344, in __init__
    ate = ARSCResTableEntry(self.buff, res_id, pc)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/androguard/core/bytecodes/axml/__init__.py", line 2589, in __init__
    self.item = ARSCComplex(buff, parent)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/androguard/core/bytecodes/axml/__init__.py", line 2647, in __init__ self.items.append((unpack('<I', buff.read(4))[0], ARSCResStringPoolRef(buff, self.parent)))

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/androguard/core/bytecodes/axml/__init__.py", line 2667, in __init__
    raise ResParserError("res0 must be always zero!")
androguard.core.bytecodes.axml.ResParserError: res0 must be always zero!


I'm seeing this with:

com.whatsapp
Version Code 230905004
Version 2.23.9.5
SHA-256 5f2a974da3d07803daf3cc29a63846d02e40d41c33c42f63f3e55ef14a07f55c


It was also reported for:

com.google.android.talk
SHA-256 6245178b03a5375f49f74f3eb40caab746655d39ee35fbfbf62299fedba037dd

Upstream suggests stop failing on that check:
https://github.com/androguard/androguard/issues/771#issuecomment-572169714

-- System Information:
Debian Release: 12.0
  APT prefers testing-security
APT policy: (500, 'testing-security'), (500, 'testing'), (1, 'experimental'), (1, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.3.0-0-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages androguard depends on:
ii  python3             3.11.2-1+b1
ii  python3-asn1crypto  1.5.1-2
ii  python3-click       8.1.3-2
ii  python3-colorama    0.4.6-2
ii  python3-ipython     8.5.0-4
ii  python3-lxml        4.9.2-1+b1
ii  python3-magic       2:0.4.26-3
ii  python3-matplotlib  3.6.3-1+b1
ii  python3-networkx    2.8.8-1
ii  python3-oscrypto    1.3.0-1
ii  python3-pydot       1.4.2-1
ii  python3-pygments    2.14.0+dfsg-1
ii  python3-yaml        6.0-3+b2

Versions of packages androguard recommends:
ii  python3-pyperclip  1.8.2-2
ii  python3-pyqt5      5.15.9+dfsg-1

androguard suggests no packages.

-- no debconf information

  • Bug#1036559: androguard: fails to parse some valid ... Hans-Christoph Steiner

Reply via email to