Skip to content

How to obtain information about a specific header in headers #217

@Airboi

Description

@Airboi

Current behavior

such like check if jwt token veified,

base.request.headers[potential_header] is Unexpected,can you help me?

metadata:
  language: v1-beta
  name: "JWT Token Signature Validation"
  description: "This BCheck checks if the server verifies the signature of JWT tokens in requests."
  author: "Your Name"
  tags: "JWT", "Security", "Authentication"

run for each:
  potential_header = "Jwt-Token"

given header then
  if "X-Jwt-Token" in {base.request.headers} then
    define:
      jwt_token = {base.request.headers[potential_header]}
      unsigned_token = {jwt_token.split('.')[0] + '.' + jwt_token.split('.')[1] + '.'}

    send request called check_unsigned:
      method: {base.request.method}
      path: {base.request.path}
      headers:
        {potential_header}: {unsigned_token}
      body: {base.request.body}

    if {check_unsigned.response.status_code} is "200" then
      report issue:
        severity: high
        confidence: certain
        detail: "The server does not verify the signature of the JWT token, making it vulnerable to forgery attacks."
        remediation: "Ensure the server validates the signature of JWT tokens before processing the request."
    end if
  end if

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions