1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-13 02:30:11 +01:00

PoC + writeup + patch

6c6dc25112/fdroidserver.patch (L28)

https://github.com/androguard/androguard/issues/1030
refs #1128

(this is an excerpt of the original patch)
This commit is contained in:
FC (Fay) Stegerman 2024-04-09 11:19:21 +02:00 committed by Hans-Christoph Steiner
parent 312f822764
commit 6f5fd2b132

View File

@ -3179,6 +3179,12 @@ def signer_fingerprint(cert_encoded):
def get_first_signer_certificate(apkpath):
"""Get the first signing certificate from the APK, DER-encoded."""
class NoOverwriteDict(dict):
def __setitem__(self, k, v):
if k not in self:
super().__setitem__(k, v)
cert_encoded_v1 = None
cert_encoded_v2 = None
cert_encoded_v3 = None
@ -3191,6 +3197,7 @@ def get_first_signer_certificate(apkpath):
cert_encoded_v1 = get_certificate(apk.read(certs_v1[0]))
apkobject = get_androguard_APK(apkpath)
apkobject._v2_blocks = NoOverwriteDict()
certs_v2 = apkobject.get_certificates_der_v2()
if len(certs_v2) > 0:
logging.debug(_('Using APK Signature v2'))