httptoolkit / httptoolkit-android

Automatic Android interception & debugging with HTTP Toolkit, for Android
https://httptoolkit.com
GNU Affero General Public License v3.0
476 stars 72 forks source link

Error ERR_CERT_DATE_INVALID when using ADB method #2

Closed richerve closed 3 years ago

richerve commented 3 years ago

Hi, I'm trying out the app to capture traffic from my android phone and it looks pretty cool, but have a small issue with certs.

I tried first to use the user certificate method and it didn't work because I'm running an android version 7+. Later I tried the ADB method, as my phone is rooted, and it successfully works in terms of the certificate injection, but then I noticed that it cannot use the certificate because of the aforementioned error ERR_CERT_DATE_INVALID, even when trying the the "amiusing" site.

Inspecting the cert, I can verify that is using the mocked cert CN: HTTP Toolkit CA, with the following validity period:

Issued: Dec 31, 2020 Expires: Jan 1, 2021

I'm trying this out today, of course. Not sure if those dates or the change of year has any effect.

I installed the apk directly from the releases site in this repo.

pimterry commented 3 years ago

Hi @richerve that's unusual, and very interesting.

It's possible there's something awry with certificate date generation on the 1st of the year, although I haven't seen this elsewhere myself, and it seems to work for me right now. Could you please export the public CA certificate and share it here, so I can take a look? I think the easiest way is:

Can you still reproduce the issue today? When exactly did you first install HTTP Toolkit?

richerve commented 3 years ago

@pimterry I'll give that a try, haven't used it today or after opening the issue

richerve commented 3 years ago

I was finally able to test this again. It's working without issue. I'm not really sure why it failed before.

The certificate dates say now issued Jan 15, 2021 and expires Jan 16, 2022.

Maybe the duration of one day only was considered an error before.

Thanks for your help @pimterry. Sorry for the noise.

pimterry commented 3 years ago

Great! I suspect this is a timing issue that only appears at certain times on the 1st day of the year. That's not perfect, but it does mean it won't be a problem right now, and I've got almost a whole year to properly fix it :smiley:. Thanks for letting me know anyway, I'll investigate now, and make sure this is sorted well before January 1st next year.