<!-- Source: @site/projects/sqlens-for-laravel/docs/rules/sec-auth-role-anonymous-no-password.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-role-anonymous-no-password/ -->

# SEC.AUTH.ROLE_ANONYMOUS_NO_PASSWORD — No name required, and no password either

> The two worst account states at once, and the shortest way into a server that exists.

- **Category:** security
- **Severity:** critical
- **Level:** 0
- **Confidence:** deterministic
- **Downtime class:** none — the finding is about an account, not about a statement
- **Stability:** stable
- **Suites:** audit
- **Applies to:** MySQL 8.4

## There is no step to get past

The empty user name means a client from a matching host picks whatever name it likes — an account row
with an empty `User` matches any name the server does not otherwise know. The empty credential means
nothing is then asked of it.

Neither half requires the attacker to know anything, and there is no second step to detect. This is
the worst account state this package can report.

## Bad

```sql
-- No name required, and no password either.
CREATE USER ''@'localhost';
```

## Good

```sql
-- There is no configuration that makes this safe. Remove it.
DROP USER ''@'localhost';
```

Unlike most findings in this catalog, there is no second option. An anonymous account with a password
is at least arguable; this one is not.

## One finding, not two

An anonymous account with no password could be described by three rules — this one,
[`SEC.AUTH.ROLE_ANONYMOUS`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-role-anonymous.md) and
[`SEC.AUTH.ROLE_NO_PASSWORD`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-role-no-password.md). You get **one**.

That is a deliberate decision rather than a happy accident: results are deduplicated by rule id *and*
location, so two ids about one account are two findings that both survive, and the reader is left to
work out that they name the same thing. The narrower statements yield to this one, which says
strictly more.

## What is not reported

The same exclusions as its sibling: PostgreSQL by construction, the engine's own system accounts, and
an account whose record could not be read — as `undetermined`, never as a clean bill.

## Related

- [`SEC.AUTH.ROLE_ANONYMOUS`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-role-anonymous.md) — the same catch-all account, with a password.
- [`SEC.AUTH.ROLE_NO_PASSWORD`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-role-no-password.md) — a named account with no password.
