<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: BlackNeuron</title>
    <description>The latest articles on DEV Community by BlackNeuron (@blackneuron).</description>
    <link>https://dev.to/blackneuron</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4006713%2Ffdd4a936-d6b9-4e89-a8e7-439de7b232c8.png</url>
      <title>DEV Community: BlackNeuron</title>
      <link>https://dev.to/blackneuron</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/blackneuron"/>
    <language>en</language>
    <item>
      <title>I put Cloudflare in front of my site, then found my origin one DNS record away from undoing it</title>
      <dc:creator>BlackNeuron</dc:creator>
      <pubDate>Sun, 28 Jun 2026 16:50:50 +0000</pubDate>
      <link>https://dev.to/blackneuron/i-put-cloudflare-in-front-of-my-site-then-found-my-origin-one-dns-record-away-from-undoing-it-49bf</link>
      <guid>https://dev.to/blackneuron/i-put-cloudflare-in-front-of-my-site-then-found-my-origin-one-dns-record-away-from-undoing-it-49bf</guid>
      <description>&lt;p&gt;You move your site behind Cloudflare (or CloudFront, or any CDN/WAF), watch the dashboard light up green, and feel safe. The edge will soak up the floods now. Right?&lt;/p&gt;

&lt;p&gt;Mostly. But there is a quiet failure mode that undoes the whole thing in one step, and almost nobody tests for it: &lt;strong&gt;origin IP exposure&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem in one sentence
&lt;/h2&gt;

&lt;p&gt;A CDN only filters the traffic that actually passes &lt;em&gt;through&lt;/em&gt; it. If your origin server still answers on its own public IP, an attacker who learns that IP just connects straight to it, and every layer of DDoS and WAF protection you are paying for is bypassed.&lt;/p&gt;

&lt;p&gt;The edge is protecting a secret (your origin IP), not a wall. And secrets leak.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the secret leaks
&lt;/h2&gt;

&lt;p&gt;You do not need to breach anything to find an origin. The data is usually already public:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Certificate Transparency logs.&lt;/strong&gt; Every TLS certificate ever issued is logged publicly. Search &lt;code&gt;crt.sh&lt;/code&gt; for a domain and you get a tidy list of its subdomains, including the &lt;code&gt;dev&lt;/code&gt;, &lt;code&gt;staging&lt;/code&gt;, and &lt;code&gt;mail&lt;/code&gt; hosts nobody remembered to put behind the CDN.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boring subdomains.&lt;/strong&gt; &lt;code&gt;mail.&lt;/code&gt;, &lt;code&gt;smtp.&lt;/code&gt;, &lt;code&gt;vpn.&lt;/code&gt;, &lt;code&gt;cpanel.&lt;/code&gt; and friends are hard to proxy through a web CDN, so they frequently resolve straight to the origin, on the same IP as the "protected" site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS history.&lt;/strong&gt; The A record from before you switched to the CDN is often still sitting in historical DNS datasets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Find one of those, confirm the IP serves the real site, and the CDN is now optional.&lt;/p&gt;

&lt;h2&gt;
  
  
  So I built a small tool to check my own
&lt;/h2&gt;

&lt;p&gt;I wanted a one-command answer to "is my origin reachable past my CDN, right now?" So I wrote &lt;strong&gt;&lt;code&gt;origin-exposure-check&lt;/code&gt;&lt;/strong&gt; in Rust. It does exactly the discovery an attacker would, against a domain you own, so you find the leak first.&lt;/p&gt;

&lt;p&gt;It is deliberately boring on the network: a few DNS lookups, one &lt;code&gt;crt.sh&lt;/code&gt; query, and a handful of normal GET requests. No flooding, no attacks. Single binary, no config.&lt;/p&gt;

&lt;p&gt;Here is the whole flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pull the &lt;strong&gt;published edge ranges&lt;/strong&gt; (Cloudflare, CloudFront) so we can &lt;em&gt;exclude&lt;/em&gt; the legitimate edge IPs.&lt;/li&gt;
&lt;li&gt;Fetch a &lt;strong&gt;baseline&lt;/strong&gt; of the site through the CDN, and fingerprint the response.&lt;/li&gt;
&lt;li&gt;Enumerate candidate hosts from &lt;strong&gt;common subdomains + Certificate Transparency&lt;/strong&gt; (&lt;code&gt;crt.sh&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;For every candidate IP that is &lt;strong&gt;not&lt;/strong&gt; an edge IP and &lt;strong&gt;not&lt;/strong&gt; the front door, make a &lt;strong&gt;direct request to that IP while presenting the real hostname&lt;/strong&gt;, deliberately bypassing DNS and the CDN.&lt;/li&gt;
&lt;li&gt;If the origin answers with your site, that is &lt;code&gt;EXPOSED&lt;/code&gt;. If it refuses, &lt;code&gt;CONTAINED&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The interesting part is step 4. To test reachability you force a TLS connection to a specific IP but set the SNI/Host to the real domain, so the origin thinks it is a normal request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Force TLS to a specific IP while presenting the real hostname (SNI),&lt;/span&gt;
&lt;span class="c1"&gt;// i.e. deliberately bypass DNS/CDN. Cert validity is ignored on purpose:&lt;/span&gt;
&lt;span class="c1"&gt;// we are probing reachability, not trust.&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;connector&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;native_tls&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;TlsConnector&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;.danger_accept_invalid_certs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;.danger_accept_invalid_hostnames&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;.build&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;TcpStream&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;tls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;connector&lt;/span&gt;&lt;span class="nf"&gt;.connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// domain = SNI, ip = where we actually connect&lt;/span&gt;
&lt;span class="n"&gt;tls&lt;/span&gt;&lt;span class="nf"&gt;.write_all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nd"&gt;format!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"GET / HTTP/1.1&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s"&gt;Host: {domain}&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="s"&gt;Connection: close&lt;/span&gt;&lt;span class="se"&gt;\r\n\r\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.as_bytes&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the bytes that come back match the baseline fingerprint, that IP is serving your real site directly. Caught.&lt;/p&gt;

&lt;p&gt;It also handles the obvious false positive: if &lt;em&gt;every&lt;/em&gt; candidate IP returns byte-identical content, you are on an anycast host platform (Vercel, Netlify, Cloudflare Pages) where the host &lt;em&gt;is&lt;/em&gt; the edge, there is no separate origin to expose, and it says so instead of crying wolf.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo run &lt;span class="nt"&gt;--release&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; example.com
&lt;span class="c"&gt;# or build once, then:&lt;/span&gt;
./target/release/origin-exposure-check example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;CONTAINED&lt;/code&gt; run looks calm. An &lt;code&gt;EXPOSED&lt;/code&gt; run hands you the IPs and the fix:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fix: restrict the origin firewall to the CDN's published ranges (or use a private tunnel so there is no public origin IP), then re-run this check.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the actual remediation: your origin should only accept connections from your CDN's IP ranges, or have no public inbound listener at all (a tunnel). Allow the world, and the CDN is decoration.&lt;/p&gt;

&lt;h2&gt;
  
  
  One important rule
&lt;/h2&gt;

&lt;p&gt;Run it only against domains and infrastructure &lt;strong&gt;you own or are explicitly authorized to test&lt;/strong&gt;. It is a self-audit, and it only consumes already-public data, but point it at your own stuff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code + the deeper write-up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Tool (MIT, Rust): &lt;strong&gt;&lt;a href="https://github.com/blackneuron-security/origin-exposure-check" rel="noopener noreferrer"&gt;https://github.com/blackneuron-security/origin-exposure-check&lt;/a&gt;&lt;/strong&gt; (a star is appreciated if it is useful to you ⭐)&lt;/li&gt;
&lt;li&gt;The longer write-up on the mechanism and the fixes: &lt;strong&gt;&lt;a href="https://blackneuron.ai/blog/origin-ip-exposure-cdn-bypass" rel="noopener noreferrer"&gt;https://blackneuron.ai/blog/origin-ip-exposure-cdn-bypass&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you run it on your own site and get a surprising &lt;code&gt;EXPOSED&lt;/code&gt;, I would genuinely like to hear how the IP leaked. That is usually the interesting part.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written while building defensive tooling at &lt;a href="https://blackneuron.ai" rel="noopener noreferrer"&gt;BlackNeuron&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>infrastructure</category>
      <category>networking</category>
      <category>security</category>
    </item>
  </channel>
</rss>
