Leaking internal hostnames through a password-reset email
A reset email from a university portal carried internal hostnames in its headers and its reset link. Where each one came from and how it was fixed.
- Published
- Reading
- 7 min
- Tags
- email, host-header, disclosure
During an assessment for a university client we requested a password reset and read the raw email. It named four internal machines. None of them should have been visible from outside.
The email
Headers, trimmed:
Received: from mta-int-03.ad.campus.example (10.12.4.33)
by relay1.campus.example with ESMTP; Tue, 22 Sep 2026 09:14:02 -0500
Received: from portal-app-02.ad.campus.example (10.12.8.17)
by mta-int-03.ad.campus.example; Tue, 22 Sep 2026 09:14:01 -0500
X-Originating-Host: portal-app-02.ad.campus.example
X-Mailer: PortalNotify/4.2 (build host ci-runner-07.ad.campus.example)
Message-ID: <a83f...@portal-app-02.ad.campus.example>
And the body:
Reset your password:
http://portal-app-02.ad.campus.example:8080/account/reset?token=b6c1...e04
That is the app server, the internal mail relay, a CI runner, their internal IP addresses, and a non-TLS port on the app server. The link did not even work from outside, so real users had been getting broken reset emails for months.
Where each one came from
The Received lines and Message-ID came from the mail path. The app handed mail to an internal relay, which forwarded to the edge without stripping headers.
X-Mailer came from the notification library, which stamped its build host into the version string.
The reset link came from the request. The app built it from the Host header. Behind the load balancer that header was rewritten to the backend’s name:
GET /account/forgot HTTP/1.1
Host: portal-app-02.ad.campus.example:8080
X-Forwarded-Host: portal.campus.example
X-Forwarded-Proto: https
The app read Host and ignored X-Forwarded-Host. We also checked whether we could set Host ourselves and point reset links at our own server. We could not; the load balancer overwrote it. So this was a disclosure, not an account takeover.
The fix
The client’s team changed three things:
- The app builds reset links from a configured base URL,
https://portal.campus.example, and never from request headers. - The edge relay strips
Receivedheaders from internal hops and rewritesMessage-IDto the public domain. - The notification library’s version string no longer includes the build host.
The reset email after the fix:
Received: from relay1.campus.example by mx.google.com ...
Message-ID: <a83f...@portal.campus.example>
Reset your password:
https://portal.campus.example/account/reset?token=19d0...7fa
Why bother
Hostnames on their own are not a vulnerability. But they tell an attacker how a network is laid out, which hosts run what, and which naming scheme to guess. Here they also pointed at a CI runner, which is usually a better target than the app. Requesting a reset and reading the raw source takes two minutes. We now do it on every engagement.