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

[Bug] Private Keys Leak to logs and insecure memory #853

Open
0xAlcibiades opened this issue Jan 10, 2025 · 3 comments
Open

[Bug] Private Keys Leak to logs and insecure memory #853

0xAlcibiades opened this issue Jan 10, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@0xAlcibiades
Copy link

Component

Other (please provide more details)

What version of Alloy are you on?

0.5.4

Operating System

None

Describe the bug

For the local signer alloy does not use the secrets crate or other solution to protect keys, alloy should by default use secure secrets management, or implement a SecureLocalSigner if the concern here is compatibility with no_std.

@0xAlcibiades 0xAlcibiades added the bug Something isn't working label Jan 10, 2025
@0xAlcibiades 0xAlcibiades changed the title [Bug] Private Keys Leak to Logs and insecure memory [Bug] Private Keys Leak to logs and insecure memory Jan 10, 2025
@mattsse
Copy link
Member

mattsse commented Jan 10, 2025

could you please provide more specifics, which type leaks to debug?

@0xAlcibiades
Copy link
Author

0xAlcibiades commented Jan 10, 2025

could you please provide more specifics, which type leaks to debug?

So the issue is that the scalar underlying SecretKey isn't actually protected using the secrets crate here, i.e. the underlying scalar is accessible generally both in memory and to be logged out.

This would affect shared tenant systems where the memory could be inspected, and distributed tracing types of scenarios

This is actually an issue with the implementation of the underlying ECDSA library used in alloy, but the information can be protected as such:

https://github.com/warlock-labs/sylow/blob/main/src/secrets.rs

h/t to @trbritt

@mattsse
Copy link
Member

mattsse commented Jan 11, 2025

Secretkey does not log internals

impl<C> Debug for SecretKey<C>
where
    C: Curve,
{
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.debug_struct(core::any::type_name::<Self>())
            .finish_non_exhaustive()
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants