/

CVE-2026-104073

Severity:

HIGH RISK

(7.6)

Server-Side Template Injection (CWE-79) in NetBox Links

CVE-2026-104073

Awaiting Analysis

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-79, CWE-668

Impact:

Credential Theft and Account Takeover

Severity:

HIGH RISK

(7.6)

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 server-side template injection vulnerability in NetBox custom link templates can expose sensitive request data to template expressions. A low-privileged user with permission to add custom links may cause session cookies or API tokens to be disclosed when a more privileged user views affected content, potentially enabling account takeover.

A server-side template injection vulnerability in NetBox custom link templates can expose sensitive request data to template expressions. A low-privileged user with permission to add custom links may cause session cookies or API tokens to be disclosed when a more privileged user views affected content, potentially enabling account takeover.

Affected context

The issue may occur in NetBox deployments where:

  • Low-privileged users can create or modify custom links
  • User-controlled templates are rendered with access to the raw Django HttpRequest object
  • Template output is later displayed to privileged users
  • HTML sanitization does not remove all browser-interpreted exfiltration paths

Exploitation depends on the relevant permission model, template rendering behavior, and whether privileged users view the affected object.

The issue may occur in NetBox deployments where:

  • Low-privileged users can create or modify custom links
  • User-controlled templates are rendered with access to the raw Django HttpRequest object
  • Template output is later displayed to privileged users
  • HTML sanitization does not remove all browser-interpreted exfiltration paths

Exploitation depends on the relevant permission model, template rendering behavior, and whether privileged users view the affected object.

Exploit preconditions

  • Attack surface: NetBox custom link template rendering and subsequent browser display
  • Required access: A user account with the ability to add custom links
  • Trigger point: A privileged user viewing an object containing the attacker-controlled custom link
  • Why exploitation is possible: Template expressions can access request-related data, while rendered output may still cause a victim's browser to transmit sensitive values to an external destination
  • Attack surface: NetBox custom link template rendering and subsequent browser display
  • Required access: A user account with the ability to add custom links
  • Trigger point: A privileged user viewing an object containing the attacker-controlled custom link
  • Why exploitation is possible: Template expressions can access request-related data, while rendered output may still cause a victim's browser to transmit sensitive values to an external destination

Why this happens

The underlying bug is the exposure of a raw request object to a user-controlled server-side template context. This creates a confused trust boundary in which template authors can access request attributes that should remain unavailable to untrusted content.

The issue maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-controlled template content can influence rendered browser output. It also relates to CWE-668: Exposure of Resource to Wrong Sphere, since sensitive request data is made available to a less-trusted template context.

The underlying bug is the exposure of a raw request object to a user-controlled server-side template context. This creates a confused trust boundary in which template authors can access request attributes that should remain unavailable to untrusted content.

The issue maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-controlled template content can influence rendered browser output. It also relates to CWE-668: Exposure of Resource to Wrong Sphere, since sensitive request data is made available to a less-trusted template context.

Potential impact

  • Session cookies may be disclosed
  • API tokens may be exposed
  • A victim account may be taken over
  • Attackers could perform actions available to compromised users
  • Sensitive application data may be accessed or modified
  • Administrative compromise could occur if a privileged account is affected
  • Session cookies may be disclosed
  • API tokens may be exposed
  • A victim account may be taken over
  • Attackers could perform actions available to compromised users
  • Sensitive application data may be accessed or modified
  • Administrative compromise could occur if a privileged account is affected

General mitigation guidance

Mitigation generally focuses on separating untrusted custom-link authors from sensitive request data and ensuring that rendered content cannot create unintended browser-side data flows.

Common defensive patterns include:

  • Removing raw request objects and credential-bearing attributes from untrusted template contexts
  • Exposing only a narrowly defined, allowlisted set of non-sensitive template variables
  • Treating custom link templates as untrusted content and applying context-aware output encoding
  • Enforcing strict, allowlisted URL and attribute policies after rendering
  • Applying a restrictive Content Security Policy where compatible with application behavior
  • Limiting custom-link creation to trusted roles and reviewing permission assignments
  • Preventing session identifiers and API credentials from being exposed to client-rendered content
  • Using secure cookie attributes and short-lived, narrowly scoped tokens to reduce residual risk

Mitigation generally focuses on separating untrusted custom-link authors from sensitive request data and ensuring that rendered content cannot create unintended browser-side data flows.

Common defensive patterns include:

  • Removing raw request objects and credential-bearing attributes from untrusted template contexts
  • Exposing only a narrowly defined, allowlisted set of non-sensitive template variables
  • Treating custom link templates as untrusted content and applying context-aware output encoding
  • Enforcing strict, allowlisted URL and attribute policies after rendering
  • Applying a restrictive Content Security Policy where compatible with application behavior
  • Limiting custom-link creation to trusted roles and reviewing permission assignments
  • Preventing session identifiers and API credentials from being exposed to client-rendered content
  • Using secure cookie attributes and short-lived, narrowly scoped tokens to reduce residual risk

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules that flag raw request objects or credential-related attributes exposed to template contexts
  • Code review checks for server-side rendering of user-controlled templates
  • Tests that verify sensitive request data is unavailable to custom-link authors
  • Dynamic tests for unexpected external resource references in rendered custom-link output
  • Content Security Policy and network monitoring for unusual outbound requests from administrative browsers
  • Policy enforcement requiring review or approval for custom links that contain dynamic template expressions

Automated security review tools can help identify unsafe template context construction and missing output restrictions.

Detection approaches may include:

  • Static analysis rules that flag raw request objects or credential-related attributes exposed to template contexts
  • Code review checks for server-side rendering of user-controlled templates
  • Tests that verify sensitive request data is unavailable to custom-link authors
  • Dynamic tests for unexpected external resource references in rendered custom-link output
  • Content Security Policy and network monitoring for unusual outbound requests from administrative browsers
  • Policy enforcement requiring review or approval for custom links that contain dynamic template expressions

Automated security review tools can help identify unsafe template context construction and missing output restrictions.

Sources

SourceLink
github.comgithub.com/netbox-community/netbox/issues/22607
github.comgithub.com/netbox-community/netbox/pull/22616
github.comgithub.com/netbox-community/netbox/releases#release-v4.7.0
vulncheck.comvulncheck.com/advisories/netbox-session-hijacking-via-custom-links

Frequently asked

questions

It may be exploitable through the NetBox web interface when an attacker can create a custom link and a privileged user later views the affected content. The exact scope depends on network access and permission configuration.

The described scenario requires a low-privileged account with the ability to add custom links. A victim with access to the relevant object must also render the affected content.

Do not expose the raw request object or credential-bearing data to untrusted templates. Use a small allowlist of non-sensitive variables, strict output encoding, and restrictive URL policies.

Treat user-authored templates as untrusted code, apply least-privilege permissions, test template contexts for sensitive data exposure, and monitor rendered output for unauthorized external requests.

It may be exploitable through the NetBox web interface when an attacker can create a custom link and a privileged user later views the affected content. The exact scope depends on network access and permission configuration.

The described scenario requires a low-privileged account with the ability to add custom links. A victim with access to the relevant object must also render the affected content.

Do not expose the raw request object or credential-bearing data to untrusted templates. Use a small allowlist of non-sensitive variables, strict output encoding, and restrictive URL policies.

Treat user-authored templates as untrusted code, apply least-privilege permissions, test template contexts for sensitive data exposure, and monitor rendered output for unauthorized external requests.

Find out what's already
exploitable in your codebase.