8000 Timing vulnerability in sample code? · Issue #9856 · dotnet/dotnet-api-docs · GitHub
[go: up one dir, main page]

Skip to content
8000
Timing vulnerability in sample code? #9856
Open
@Danghor

Description

@Danghor

https://github.com/dotnet/dotnet-api-docs/blob/2d0e5e61b8635b57bdb26b42d879382252edfc62/snippets/csharp/System.Security.Cryptography/HMACSHA256/Overview/hmacsha256.cs#L110C17-L116C18

storedHash is directly taken from the source file, i.e. the potentially manipulated file. Would this loop not cause a timing vulnerability? The attacker could guess the first byte of the MAC, send it together with the manipulated file to the server and observe for which guess the server takes slightly longer to process. This guess can be assumed to be the correct first key MAC byte. Then the attacker can proceed to the next byte etc., essentially brute forcing the MAC one byte after another.

I think creating a hash value of both the expected and the actual MAC value and then comparing the hash value could potentially solve this.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.SecurityIssues related to security practices for .NET developers.untriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0