Skip to content

PSK Auth Bug #126

@avirtuos

Description

@avirtuos

PSK Auth in auth.rs near line 133 should not be comparing the literal PSK but rather validating a field that was encrypted using the PSK (e.g. encrypted hash of the request (e.g. action, timestamp, claimed identity, and if small enough the request params). Then using the claimed identity, we look up the associated PSK and attempt to validated the encrypted hash match the request.

       // Validate PSK
        let identities = self.identities.read().await;
        match identities.get(identity) {
            Some(expected_psk) if expected_psk.as_slice() == psk => {
                // Valid authentication
                debug!("Authenticated request from identity: {}", identity);
                Ok(request)
            }
            Some(_) => {
                error!("Invalid PSK for identity: {}", identity);
                Err(Status::permission_denied("Invalid PSK"))
            }
            None => {
                error!("Unknown identity: {}", identity);
                Err(Status::unauthenticated("Unknown identity"))
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions