/

CVE-2026-54635

Severity:

HIGH RISK

(7.5)

Broken Auth (CWE-287) in pytonapi Webhook Dispatcher

CVE-2026-54635

Deferred

Vulnerability type

Category:

Broken Authentication

CWE:

CWE-287

Impact:

Unauthorized Request Forgery to Webhook Handlers

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A broken authentication check in pytonapi's TonapiWebhookDispatcher lets custom webhook endpoints skip Authorization header validation.

If a webhook handler is registered with a documented custom path, bearer tokens are never associated with that path, so unauthenticated remote attackers can POST forged payloads to victim-defined handlers.

A broken authentication check in pytonapi's TonapiWebhookDispatcher lets custom webhook endpoints skip Authorization header validation.

If a webhook handler is registered with a documented custom path, bearer tokens are never associated with that path, so unauthenticated remote attackers can POST forged payloads to victim-defined handlers.

Affected context

This vulnerability affects applications that use pytonapi versions 2.0.0 through 2.2.0 and register webhook handlers with a non-default, documented path argument on TonapiWebhookDispatcher.

Under these conditions, the dispatcher's setup() logic stores bearer tokens only for default suffix paths and omits the custom path from its internal token map.

As a result, requests targeting the custom webhook route are treated as if no authentication were configured, even though the application developer may assume bearer token protection is in place.

This vulnerability affects applications that use pytonapi versions 2.0.0 through 2.2.0 and register webhook handlers with a non-default, documented path argument on TonapiWebhookDispatcher.

Under these conditions, the dispatcher's setup() logic stores bearer tokens only for default suffix paths and omits the custom path from its internal token map.

As a result, requests targeting the custom webhook route are treated as if no authentication were configured, even though the application developer may assume bearer token protection is in place.

Exploit preconditions

  • Attack surface: Publicly reachable HTTP endpoint exposed by TonapiWebhookDispatcher for webhook delivery
  • Required access: Network access to the webhook URL; no valid Authorization token is required for the vulnerable custom paths
  • Trigger point: HTTP POST (or relevant method) to the registered custom webhook path with arbitrary payload data
  • Why exploitation is possible: The dispatcher only associates bearer tokens with default suffix paths; for handlers registered using the documented path argument, self._tokens.get(path) returns None, causing the authentication guard to be bypassed and requests to be processed as authenticated.
  • Attack surface: Publicly reachable HTTP endpoint exposed by TonapiWebhookDispatcher for webhook delivery
  • Required access: Network access to the webhook URL; no valid Authorization token is required for the vulnerable custom paths
  • Trigger point: HTTP POST (or relevant method) to the registered custom webhook path with arbitrary payload data
  • Why exploitation is possible: The dispatcher only associates bearer tokens with default suffix paths; for handlers registered using the documented path argument, self._tokens.get(path) returns None, causing the authentication guard to be bypassed and requests to be processed as authenticated.

Why this happens

The core issue is a logic flaw in the authentication mapping within TonapiWebhookDispatcher.

The setup() routine records bearer tokens only for a fixed set of default webhook paths, but does not add entries for user-specified paths supplied via the documented path argument.

When a request arrives, the dispatcher checks the Authorization header only if it finds a token configured for that path; for custom paths, the lookup returns None, so the guard is effectively disabled.

This pattern maps to CWE-287: Improper Authentication, where a component fails to correctly enforce authentication controls on all relevant code paths, leading to assumptions of protection that are not actually enforced.

The core issue is a logic flaw in the authentication mapping within TonapiWebhookDispatcher.

The setup() routine records bearer tokens only for a fixed set of default webhook paths, but does not add entries for user-specified paths supplied via the documented path argument.

When a request arrives, the dispatcher checks the Authorization header only if it finds a token configured for that path; for custom paths, the lookup returns None, so the guard is effectively disabled.

This pattern maps to CWE-287: Improper Authentication, where a component fails to correctly enforce authentication controls on all relevant code paths, leading to assumptions of protection that are not actually enforced.

Potential impact

  • Remote attackers could invoke victim-defined webhook handlers without providing any credentials.
  • Application workflows relying on authenticated webhooks may be spoofed or manipulated.
  • Downstream systems that trust webhook content could be fed forged or malicious data.
  • Business logic triggered by webhooks (e.g., transactions, notifications, or account changes) could be executed under false pretenses.
  • Remote attackers could invoke victim-defined webhook handlers without providing any credentials.
  • Application workflows relying on authenticated webhooks may be spoofed or manipulated.
  • Downstream systems that trust webhook content could be fed forged or malicious data.
  • Business logic triggered by webhooks (e.g., transactions, notifications, or account changes) could be executed under false pretenses.

General mitigation guidance

Effective mitigation focuses on ensuring that authentication is consistently applied to all webhook endpoints and that path-based routing does not implicitly skip security checks.

Common defensive patterns include:

  • Centralizing authentication logic so that all routes, including custom webhook paths, are protected uniformly rather than relying on per-path token maps.
  • Treating "no configured token for this path" as a security failure that results in request rejection, rather than silently skipping authentication.
  • Using explicit configuration or declarative security policies to bind authentication requirements to paths, handlers, or route groups.
  • Applying the principle of least privilege to webhook handlers so that any single endpoint has limited capability if misused.
  • Documenting and reviewing all externally exposed webhook URLs, avoiding assumptions that a "registered handler" is automatically authenticated.

Effective mitigation focuses on ensuring that authentication is consistently applied to all webhook endpoints and that path-based routing does not implicitly skip security checks.

Common defensive patterns include:

  • Centralizing authentication logic so that all routes, including custom webhook paths, are protected uniformly rather than relying on per-path token maps.
  • Treating "no configured token for this path" as a security failure that results in request rejection, rather than silently skipping authentication.
  • Using explicit configuration or declarative security policies to bind authentication requirements to paths, handlers, or route groups.
  • Applying the principle of least privilege to webhook handlers so that any single endpoint has limited capability if misused.
  • Documenting and reviewing all externally exposed webhook URLs, avoiding assumptions that a "registered handler" is automatically authenticated.

How teams detect issues like this

Identifying this type of issue generally involves a combination of code analysis and behavioral testing:

  • Static analysis / code review: Look for authentication structures that use path-to-token maps or conditional checks where a missing token results in authentication being skipped instead of failing closed.
  • Configuration review: Inspect webhook registration points to confirm that custom path arguments are tied to concrete authentication rules, and verify that default paths and custom paths follow the same security model.
  • Dynamic testing: Use integration or security tests to send unauthenticated requests to all registered webhook endpoints and confirm that they are rejected when authentication is expected.
  • Automated tooling: Employ API security testing, fuzzing, and CI checks that enumerate routes and validate the presence of authentication guards, especially on webhook and callback endpoints.

Identifying this type of issue generally involves a combination of code analysis and behavioral testing:

  • Static analysis / code review: Look for authentication structures that use path-to-token maps or conditional checks where a missing token results in authentication being skipped instead of failing closed.
  • Configuration review: Inspect webhook registration points to confirm that custom path arguments are tied to concrete authentication rules, and verify that default paths and custom paths follow the same security model.
  • Dynamic testing: Use integration or security tests to send unauthenticated requests to all registered webhook endpoints and confirm that they are rejected when authentication is expected.
  • Automated tooling: Employ API security testing, fuzzing, and CI checks that enumerate routes and validate the presence of authentication guards, especially on webhook and callback endpoints.

Sources

SourceLink
github.comgithub.com/nessshon/tonapi/commit/854222b7ee68d3fb7b4d6d899d200f388483bd86
github.comgithub.com/nessshon/tonapi/releases/tag/v2.2.1
github.comgithub.com/nessshon/tonapi/security/advisories/GHSA-3fcr-jvgp-7f58
github.comgithub.com/pypa/advisory-database/tree/main/vulns/pytonapi/PYSEC-2026-3614.yaml

Frequently asked

questions

Yes. Any remote party that can reach the affected webhook URL can send forged requests to custom webhook handlers without a valid Authorization token.

Only network access to the vulnerable webhook endpoint is required. The attacker does not need credentials, blockchain access, or prior interaction with the service.

Ensure that authentication enforcement is applied uniformly to all webhook paths, including those registered with custom path values. The system should fail closed: if a path has no associated token or rule, the request should be rejected rather than treated as authenticated.

Adopt centralized, declarative authentication mechanisms for route protection, add automated tests that verify all external webhook endpoints require authentication where intended, and perform security reviews of any code that conditionally applies authentication based on path or configuration.

Yes. Any remote party that can reach the affected webhook URL can send forged requests to custom webhook handlers without a valid Authorization token.

Only network access to the vulnerable webhook endpoint is required. The attacker does not need credentials, blockchain access, or prior interaction with the service.

Ensure that authentication enforcement is applied uniformly to all webhook paths, including those registered with custom path values. The system should fail closed: if a path has no associated token or rule, the request should be rejected rather than treated as authenticated.

Adopt centralized, declarative authentication mechanisms for route protection, add automated tests that verify all external webhook endpoints require authentication where intended, and perform security reviews of any code that conditionally applies authentication based on path or configuration.

Find out what's already
exploitable in your codebase.