惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
IT之家
IT之家
博客园_首页
博客园 - 【当耐特】
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
GbyAI
GbyAI
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
H
Help Net Security
T
Tailwind CSS Blog
B
Blog RSS Feed
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
博客园 - 叶小钗
雷峰网
雷峰网
量子位

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I put Cloudflare in front of my site, then found my origi...
BlackNeuron · 2026-06-29 · via DEV Community

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?

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

The problem in one sentence

A CDN only filters the traffic that actually passes through 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.

The edge is protecting a secret (your origin IP), not a wall. And secrets leak.

How the secret leaks

You do not need to breach anything to find an origin. The data is usually already public:

  • Certificate Transparency logs. Every TLS certificate ever issued is logged publicly. Search crt.sh for a domain and you get a tidy list of its subdomains, including the dev, staging, and mail hosts nobody remembered to put behind the CDN.
  • Boring subdomains. mail., smtp., vpn., cpanel. 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.
  • DNS history. The A record from before you switched to the CDN is often still sitting in historical DNS datasets.

Find one of those, confirm the IP serves the real site, and the CDN is now optional.

So I built a small tool to check my own

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

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

Here is the whole flow:

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

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:

// Force TLS to a specific IP while presenting the real hostname (SNI),
// i.e. deliberately bypass DNS/CDN. Cert validity is ignored on purpose:
// we are probing reachability, not trust.
let connector = native_tls::TlsConnector::builder()
    .danger_accept_invalid_certs(true)
    .danger_accept_invalid_hostnames(true)
    .build()?;

let stream = TcpStream::connect((ip, 443))?;
let mut tls = connector.connect(domain, stream)?; // domain = SNI, ip = where we actually connect
tls.write_all(
    format!("GET / HTTP/1.1\r\nHost: {domain}\r\nConnection: close\r\n\r\n").as_bytes(),
)?;

If the bytes that come back match the baseline fingerprint, that IP is serving your real site directly. Caught.

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

Running it

cargo run --release -- example.com
# or build once, then:
./target/release/origin-exposure-check example.com

A CONTAINED run looks calm. An EXPOSED run hands you the IPs and the fix:

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.

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.

One important rule

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

Code + the deeper write-up

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

Written while building defensive tooling at BlackNeuron.