Skip to content

thread '<unnamed>' panicked at 'called Result::unwrap() on an Err value: InvalidTrailingBits' #579

@mbrunjadze-crocobet

Description

@mbrunjadze-crocobet
  • NodeJS - 12.22.1
  • @node-rs/bcrypt - 1.5.0

calling verify function with malformed hash causes nodejs process to hang

POC:

const bcrypt = require('@node-rs/bcrypt');

try {
  const result = bcrypt.verifySync('test', '$2b$10$heNneCqWJ6/hd5pb.Pbgs.Jzc/qnqf3gQRNiGkr9KbS2yFdozfQ50');
  console.log(result);
} catch (e) {
  console.log(e);
}

Output:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidTrailingBits', packages/bcrypt/src/b64.rs:181:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
[1]    17750 abort      node bcrypt-panic-poc.js

I have changed last character of hash from 2 to 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions