Skip to content
RCE Write-up Advanced

Lessons Learned #1: One line of code can make your application vulnerable (Pre-Auth RCE in Metabase…

A setup token remained valid after initialisation due to a removed line of code, allowing unauthenticated attackers to bypass authentication. Combined with a SQL injection in the H2 database driver, this led to pre-authentication remote code execution.

medium.com

Published on medium.com

Welcome all to this new series “Lessons Learned”. In this series, I plan to share some real-world vulnerabilities from the eyes of an application security engineer.

Mohamed AboElKheir, on medium.com

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the removal of code that cleared the setup token after initialisation, plus passing a user-supplied connection string to the H2 database driver which contained a SQL injection vulnerability.

Impact

An unauthenticated attacker with network access could run code on the server, leading to full compromise.

What the attacker needed

Network access to the Metabase instance

The fix

The text does not state a fix, but it should be fixed by clearing the setup token after initialisation and by not accepting complex input such as connection strings, instead building them from validated components.

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 write-up has not been written yet. The Original tab links to the source.

A setup token is a temporary password used only during installation. A developer accidentally left it active after setup, so anyone could log in. Separately, a database component had a flaw that let attackers run their own database commands, and together these let attackers run code on the server.

What is RCE?

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

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.