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

Replace base64 with base64ct #195

Closed
newpavlov opened this issue Dec 7, 2021 · 5 comments
Closed

Replace base64 with base64ct #195

newpavlov opened this issue Dec 7, 2021 · 5 comments

Comments

@newpavlov
Copy link

The base64ct crate is specifically designed to provide constant-time decoding and encoding of Base64 strings for cryptographic and security-sensitive applications. Since in this crate base64 is used for handling sensitive data, it's probably worth to replace it with base64ct.

Unfortunately, using base64ct would mean MSRV bump to at least 1.51 (for pre-1.3 versions) or to 1.56 for the latest released version.

cc @tarcieri

@Zerowalker
Copy link

Doesn't timing-attacks require physical access to the cpu that's parsing the data?
In that case isn't it a bit useless as you would practically have access to everything already?

I am probably missing something important though as it probably exists for a reason.

@SergioBenitez
Copy link
Member

Doesn't timing-attacks require physical access to the cpu that's parsing the data?

No. Timing attacks over the network (or any medium) are just as readily achieved.

@Zerowalker
Copy link

oh, had no idea that was practical, would have thought the differences around it (NIC buffering, routers, switches etc),
would make the range so big that it would be impractical decipher it.

It seems these techniques are more advanced than i thought.
In that case my take on this is to have it as an option (if the performance difference is "big").
And then give some practical example in the documentation on when the user should consider using the securer method/feature compared to the faster basic one:)

@tarcieri
Copy link
Contributor

tarcieri commented Sep 16, 2022

Exploiting sidechannels as a network-based attacker is possible. It usually involves a fairly noisy attack which is repeated over and over many times (e.g. millions of times) combined with statistical methods to observe timing variabilities. Such attacks have been used in the past for full plaintext recovery against protocols like TLS e.g. Lucky13 (great paper if you want to see how such attacks work).

However, the most practical attack against a Base64 decoder/encoder is probably going to be a local microarchitectural sidechannel. Such sidechannels have been used in a research setting to recover Base64-encoded cryptographic keys and could still be possible against e.g. a local webserver (possibly on a cotenant container or VM): https://arxiv.org/pdf/2108.04600.pdf

@SergioBenitez
Copy link
Member

Closing with my commentary at #196 (comment).

@SergioBenitez SergioBenitez closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants