Skip to content
RCE Advisory Advanced CVE-2023-51389

GHSL-2023-254_GHSL-2023-256: Potential RCE and SQL Injection in HertzBeat - CVE-2023-51389

HertzBeat used unsafe YAML deserialization in two endpoints and SQL injection in another, allowing authenticated users to execute arbitrary code or read database information. The SQL injection remained unfixed at the time of publication.

jorgectf Follow

Originally disclosed on GitHub Security Lab

HertzBeat is an open-source, real-time monitoring system with custom monitoring, high performance cluster and agentless capabilities, vulnerable to unsafe deserialization and SQL injection.

jorgectf, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application deserialised untrusted YAML with SnakeYaml without restricting allowed types, and concatenated user input into SQL queries without parameterisation.

Impact

The deserialization issues may lead to remote code execution, and the SQL injection may lead to information disclosure; the SQL injection remained unfixed at the time of publication.

What the attacker needed

Authenticated user with guest, user, or admin role; for RCE, ability to send requests or upload files; for SQL injection, TDEngine backend

How it was found

  1. Authenticate to HertzBeat with a guest, user, or admin role.
  2. Send a POST request to /api/apps/define/yml with a YAML payload that uses a JNDI gadget.
  3. The server deserialises the YAML and triggers a remote class load, leading to code execution.
  4. Alternatively, upload a malicious YAML file to /api/monitors/import to trigger deserialisation.
  5. For SQL injection, send a GET request to /api/monitor/{monitorId}/metric/{metricFull} with a crafted instance parameter.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

HertzBeat is a monitoring tool. It accepted YAML files and turned them into Java objects without checking what those objects could do, so an attacker could make the server run harmful code. It also put user input directly into a database query, letting an attacker read data they should not see.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by jorgectf

View all

34 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.