<!-- Source: @site/projects/sqlens-for-laravel/docs/rules/sec-auth-hba-open-cidr.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-hba-open-cidr/ -->

# SEC.AUTH.HBA_OPEN_CIDR — The line accepts the whole address space

> A host line matching 0.0.0.0/0 or ::/0 makes every other weakness reachable from anywhere.

- **Category:** security
- **Severity:** high
- **Level:** 0
- **Confidence:** deterministic
- **Downtime class:** none — the finding is about how the server authenticates, not about a statement
- **Stability:** stable
- **Suites:** audit
- **Applies to:** PostgreSQL 18

## Not a breach on its own — the multiplier

A line open to `0.0.0.0/0` still demands whatever its auth method demands. If that is
`scram-sha-256`, an attacker needs the password. What the open range removes is the requirement to be
anywhere in particular first, which turns a bounded risk into an internet-facing one: credential
stuffing, version fingerprinting, and every future weakness in the authentication path.

## One fact, four spellings

`pg_hba.conf` writes the same statement four ways, and `pg_hba_file_rules` splits some of them across
two columns:

```ini
host all all all               scram-sha-256
host all all 0.0.0.0/0         scram-sha-256
host all all 0.0.0.0 0.0.0.0   scram-sha-256
host all all ::/0              scram-sha-256
```

SQLens reads the canonicalized address rather than the text, so all four produce the same finding.
`samehost` and `samenet` do not: they resolve to the server's own addresses and narrow the line.

## Bad

```ini
host    all    all    0.0.0.0/0    scram-sha-256
```

## Good

```ini
hostssl all    app    10.0.4.0/24  scram-sha-256
hostssl all    app    2001:db8:4::/64  scram-sha-256
```

If the connections genuinely come from anywhere — a managed platform with rotating egress — put the
boundary somewhere that can hold one: a private network, a proxy with a fixed address, or the
provider's own allow-list.

## Related

When the same line also carries a weak method, this finding names it and points at the rule that
reports it — [`SEC.AUTH.HBA_TRUST`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-hba-trust.md),
[`SEC.AUTH.HBA_CLEARTEXT`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-hba-cleartext.md) or [`SEC.AUTH.HBA_MD5`](https://docs.pushery.com/sqlens-for-laravel/rules/sec-auth-hba-md5.md) — and
that one is the finding to fix first.
