Summary
A regular-expression construction error in Mercury causes the anonymous endpoint blocklist to omit effective protection for Jupyter Server's terminal API. An unauthenticated attacker who can reach the exposed endpoint may obtain an interactive operating-system shell, execute commands, and access data available to the Mercury process.
A regular-expression construction error in Mercury causes the anonymous endpoint blocklist to omit effective protection for Jupyter Server's terminal API. An unauthenticated attacker who can reach the exposed endpoint may obtain an interactive operating-system shell, execute commands, and access data available to the Mercury process.
Affected context
The issue affects Mercury deployments in the impacted 3.0.0 through 3.2.4 range when the application exposes Jupyter Server endpoints and relies on BLOCKED_PATTERNS to prevent anonymous access. It becomes risky when the terminal API is network-reachable and the Mercury process has access to sensitive files, credentials, services, or other runtime resources.
The issue affects Mercury deployments in the impacted 3.0.0 through 3.2.4 range when the application exposes Jupyter Server endpoints and relies on BLOCKED_PATTERNS to prevent anonymous access. It becomes risky when the terminal API is network-reachable and the Mercury process has access to sensitive files, credentials, services, or other runtime resources.
Exploit preconditions
- Attack surface: Network-accessible Mercury or Jupyter Server HTTP endpoints
- Required access: No authentication, provided the affected endpoint is reachable
- Trigger point: A request routed to the Jupyter Server terminal API
- Why exploitation is possible: A missing delimiter concatenates regular-expression patterns, causing the intended endpoint blocklist rule to fail to match the terminal endpoint
- Additional conditions: The Mercury process must have operating-system permissions and network reachability sufficient for the intended attacker actions
- Attack surface: Network-accessible Mercury or Jupyter Server HTTP endpoints
- Required access: No authentication, provided the affected endpoint is reachable
- Trigger point: A request routed to the Jupyter Server terminal API
- Why exploitation is possible: A missing delimiter concatenates regular-expression patterns, causing the intended endpoint blocklist rule to fail to match the terminal endpoint
- Additional conditions: The Mercury process must have operating-system permissions and network reachability sufficient for the intended attacker actions
Why this happens
The vulnerability results from a malformed regular-expression pattern list: two adjacent literals are concatenated because of a missing comma. This changes the matching behavior of the anonymous endpoint blocklist and leaves a security-sensitive route insufficiently protected. The issue maps primarily to CWE-185, Improper Regular Expression, and is also related to CWE-284, Improper Access Control, because the pattern error defeats an intended authorization boundary.
The vulnerability results from a malformed regular-expression pattern list: two adjacent literals are concatenated because of a missing comma. This changes the matching behavior of the anonymous endpoint blocklist and leaves a security-sensitive route insufficiently protected. The issue maps primarily to CWE-185, Improper Regular Expression, and is also related to CWE-284, Improper Access Control, because the pattern error defeats an intended authorization boundary.
Potential impact
- An unauthenticated attacker may execute operating-system commands
- The attacker could access files and data available to the Mercury process
- Application credentials or runtime secrets may be exposed
- The compromised process may be used for lateral movement or further system abuse
- Hosted notebooks, dashboards, or connected services may be modified or disrupted
- An unauthenticated attacker may execute operating-system commands
- The attacker could access files and data available to the Mercury process
- Application credentials or runtime secrets may be exposed
- The compromised process may be used for lateral movement or further system abuse
- Hosted notebooks, dashboards, or connected services may be modified or disrupted
General mitigation guidance
Mitigation generally focuses on making endpoint authorization explicit rather
than relying solely on deny-pattern matching.
Common defensive patterns include:
- Prefer explicit allowlists and route-level authorization for administrative and terminal APIs
- Require authentication and appropriate authorization before exposing interactive server functionality
- Treat endpoint filters as security-sensitive code and validate each pattern independently
- Use structured route policies instead of fragile concatenated regular expressions
- Run Mercury and Jupyter components with least-privilege operating-system and network permissions
- Reduce process access to secrets, host filesystems, cloud metadata, and unrelated services
- Apply defense-in-depth controls such as network segmentation and an authenticated reverse proxy
Mitigation generally focuses on making endpoint authorization explicit rather
than relying solely on deny-pattern matching.
Common defensive patterns include:
- Prefer explicit allowlists and route-level authorization for administrative and terminal APIs
- Require authentication and appropriate authorization before exposing interactive server functionality
- Treat endpoint filters as security-sensitive code and validate each pattern independently
- Use structured route policies instead of fragile concatenated regular expressions
- Run Mercury and Jupyter components with least-privilege operating-system and network permissions
- Reduce process access to secrets, host filesystems, cloud metadata, and unrelated services
- Apply defense-in-depth controls such as network segmentation and an authenticated reverse proxy
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis and review rules that inspect security-sensitive regular-expression lists for missing delimiters or implicit string concatenation
- Tests asserting that every protected endpoint is denied without authentication
- Route and authorization inventory reviews for Jupyter Server administrative or terminal APIs
- Integration tests covering anonymous requests to all blocked paths and near-matching paths
- Web-server logs showing unauthenticated requests to terminal endpoints or unusual terminal-session activity
- Policy enforcement requiring authentication at an independent proxy or gateway layer
Automated code-review and security-testing tools may help identify malformed patterns and missing authorization coverage.
Organizations can look for this class of issue through:
- Static analysis and review rules that inspect security-sensitive regular-expression lists for missing delimiters or implicit string concatenation
- Tests asserting that every protected endpoint is denied without authentication
- Route and authorization inventory reviews for Jupyter Server administrative or terminal APIs
- Integration tests covering anonymous requests to all blocked paths and near-matching paths
- Web-server logs showing unauthenticated requests to terminal endpoints or unusual terminal-session activity
- Policy enforcement requiring authentication at an independent proxy or gateway layer
Automated code-review and security-testing tools may help identify malformed patterns and missing authorization coverage.

