Security vulnerabilities

  • Status Closed
  • Assigned To
    cbay
  • Private
Attached to Project: Security vulnerabilities
Opened by bl4ckf1sh - 23.11.2026
Last edited by cbay - 26.11.2026

FS#564 - Python format-string injection in custom HTTP log format exposes proxy internals (core.message)

Severity: High (CVSS 3.1 AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N = 7.7). Potentially Critical by worst-case exploitation (read of proxy module globals).
Asset: https://admin.alwaysdata.com → shared HTTP proxy writing ~/admin/logs/http/
Endpoint: POST /site/<id>/ (fields log_type=CUSTOM, log_file, log_format). Same fields exist in the API: PATCH https://api.alwaysdata.com/v1/site/<id>/
Tested on: my own free account (bl4ckf1sha), my own site #1108777, 22 Nov 2026 (re-verified the same day, all outputs below reproduced).

## Summary
The Customized HTTP log format (Web > Sites > [site] > Logs) is rendered by the shared HTTP proxy with Python str.format(). str.format() allows attribute and index access inside placeholders ({obj.attr}, {obj[key]}). Any customer can walk the object graph inside the proxy process, and the result is written to their own access log, which they can read in the admin.
request_header is an instance of the proxy's own Python class core.message.Headers (a subclass of h2o.H2oHeaders). Its format is a Python bound method, so {request_header.format.globals[NAME]} gives read access to any global of the proxy module core.message: imported modules, configuration, os.environ, and secrets kept in memory by a component that serves every customer.
I stopped at proof, as the program rules require. I did not read any global value, configuration, environment variable or other internal data.

## Steps to reproduce (own site only)
1. admin.alwaysdata.com > Web > Sites > edit your site > Logs: Type = Customized, File name = bl4cklog, Format = bl4ck A={completion_date.year} B={completion_date.class} C={request_method.class}. Submit (it is accepted).
2. curl -s -o /dev/null https://<account>.alwaysdata.net/
3. Logs > HTTP requests (/site/<id>/logs/?type=http), or over SSH: grep -rh bl4ck ~/admin/logs/http/. Result: bl4ck A=2026 B=<class 'datetime.datetime'> C=<class 'str'> (attribute traversal is evaluated by the proxy).
4. Format = bl4ck3 R={request_header.class} M={request_header.class.module}. Result: R=<class 'core.message.Headers'> M=core.message
5. Format = bl4ck4 MRO={request_header.class.mro}. Result: MRO=(<class 'core.message.Headers'>, <class 'h2o.H2oHeaders'>, <class 'object'>)
6. Format = bl4ck5 Q={request_header.format.qualname} T={request_header.format.class} M={request_header.format.module}. Result: Q=Headers.format T=<class 'method'> M=core.message. A Python-level bound method of the proxy is reachable; in CPython its globals is the module's global dict.
7. Clean up: set Type back to Advanced and clear File name and Format.

PoC (attached logformat_poc.sh): ACC=<account>; curl -s -o /dev/null https://$ACC.alwaysdata.net/?poc=1; sleep 5; grep -rh bl4ck /home/$ACC/admin/logs/http/ | tail -n 2

## Note on the admin validator
A format containing globals is refused at save time with 'Invalid format'. The admin appears to test-render the format with its own sample values, whose types differ from the objects the proxy uses at runtime. This is not a security boundary: the real runtime objects differ from those samples (steps 4-6 pass validation and expose proxy internals), and the same log_format field can be set through the API (PATCH /v1/site/<id>/), which may not apply the same check. I could not test the API because token creation requires 2FA. I did not try any other bypass.

## Impact
A free account can make the shared HTTP proxy evaluate attacker-controlled attribute lookups and return the results through the normal log viewer. Following the standard chain (bound method > globals > modules > os.environ and configuration), an attacker could read secrets of the core platform component that handles all customer traffic. Depending on what it holds, this could include TLS private keys of other customers, internal credentials or tokens. This matches the Critical category ('accessing in read mode the core platform architecture'). Only the evaluation and the reachable path are shown here. No data was read.

## Fix
- Do not render user templates with str.format() or format_map(). Allow only the documented variable names with an optional format spec, and reject any '.' or '[' in the field name. Alternatively override string.Formatter.get_field() to forbid attribute and index access.
- Pass plain str or int values to the renderer, never internal objects (core.message.Headers).
- Apply the same check in the admin validator and in the API.

Closed by  cbay
26.11.2026 16:16
Reason for closing:  Fixed
Admin
cbay commented on 23.11.2026 14:57

Hello,

Can you verify that the vulnerability is fixed?

Kind regards,
Cyril

Hello Cyril,

Thanks for the quick fix. I re-tested on my own site (#1108777) and it is fixed:

- Format "fixcheck CTRL={status} {request_method} A={completion_date.year} B={completion_date.class} R={request_header.class}"

is still accepted in the admin, but the proxy no longer evaluates it. The 4 requests I sent were written in the
default log format, with no attribute lookup in the output.

- Control: a normal format "fixctl S={status} M={request_method} Y={completion_date:%Y}" is applied correctly

("fixctl S=200 M=GET Y=2026"), so custom formats still work and only the traversal is blocked.

I have put my site's log settings back to default.

Kind regards,
bl4ckf1sh

Admin
cbay commented on 24.11.2026 08:14

Thanks!

You can claim your bounty by opening a support ticket.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing