Skip to content

Null byte in token endpoint parameters (code / client_id) triggers HTTP 500 instead of OAuth error response #2755

Description

@Allen-wick

Summary

Sending an OAuth token request where the code or client_id form parameter contains a null byte (%00) causes SimpleLogin's token endpoint to return HTTP 500 (its generic "Server error" HTML page) instead of the RFC 6749 §5.2 error response (HTTP 400 with a JSON {"error": "..."} body).

Affected Endpoint

POST /oauth2/token

Steps to Reproduce

# Null byte in code → HTTP 500
curl -i -X POST 'http://localhost:7777/oauth2/token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=authorization_code&code=test%00code&client_id=fuzz-client&client_secret=secret'

# Null byte in client_id → HTTP 500
curl -i -X POST 'http://localhost:7777/oauth2/token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=authorization_code&code=test&client_id=fuzz-client%00evil&client_secret=secret'

Actual response (both):

HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=utf-8

<html>... "Server error — Looks like we are having some server issues..." ...</html>

Expected response (RFC 6749 §5.2):

HTTP/1.1 400 Bad Request
Content-Type: application/json
{"error": "invalid_request"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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