Skip to content

Detecting and recovering from a blocklist hit — UCEPROTECT, Spamhaus, SORBS

The end-to-end workflow when one of your sending IPs lands on a public blocklist: detect, classify, remediate the root cause, file the delisting, verify.

A customer reports their confirmation emails to a specific recipient domain are bouncing with 554 5.7.1 service unavailable; client host [203.0.113.45] blocked by zen.spamhaus.org. Your outbound queue starts backing up. You check the IP — yes, it’s on Spamhaus Zen. The question is what caused it (compromised account? legitimate campaign that looked spammy? a forwarded burst?), what to do in the next thirty minutes to stop the bleeding, and how to file a delisting that actually succeeds rather than a request that bounces and locks the IP out of the form for a week.

What’s happening

Public blocklists (also called DNSBLs) publish lists of IPs and sometimes domains that they believe are sending unsolicited mail. Receiving MTAs query them at SMTP connection time — if the IP matches a list the operator subscribes to, the connection is rejected or scored heavily. The three you will deal with most often, with very different characters:

  • Spamhaus — the most trusted, most-subscribed-to. Zen is a composite of SBL (manual listings, often network-wide), CSS (snowshoe and bulk), XBL (CBL — exploited hosts), and PBL (dynamic IP ranges). A listing on SBL or CSS is a hard problem; a listing on CBL/XBL is usually a compromised host.
  • UCEPROTECT — three escalating levels. Level 1 is per-IP, fast to fix. Level 2 lists whole /24 subnets when several IPs in them are bad. Level 3 lists whole ASNs. Cleanup for L2/L3 requires the network owner, not just you. Many MTAs ignore UCEPROTECT L2/L3 because of its breadth; some still use it.
  • SORBS — multiple zones. The most commonly used is dnsbl.sorbs.net (a composite). SORBS has historically been slow on delisting and has zones with their own remediation criteria. Less authoritative than Spamhaus but still consulted.

A listing has three possible root causes:

  1. A compromised sending source — a stolen SMTP credential, a wide-open relay, or a script kit on the box itself.
  2. Genuine volume that triggered automated detection — a marketing burst from a cold IP, or a list with too many spamtraps in it.
  3. Collateral damage — your IP is in a /24 flagged for L2/L3, or in an ASN reputation list, and the listing isn’t really about you.

The correct workflow depends on which one. Filing a delisting before fixing the cause is wasted credits and often a longer ban.

How to verify

Confirm which list, on what IP, with what listing reason:

# Reverse octets for DNSBL queries
IP=203.0.113.45
REV=$(echo $IP | awk -F. '{print $4"."$3"."$2"."$1}')

# Spamhaus Zen (composite)
dig +short A ${REV}.zen.spamhaus.org
# 127.0.0.2  <-- SBL listing
# 127.0.0.4  <-- CBL/XBL
# 127.0.0.10 <-- PBL (ISP-marked dynamic range)

# Spamhaus also publishes a reason via TXT
dig +short TXT ${REV}.zen.spamhaus.org

# UCEPROTECT
dig +short A ${REV}.dnsbl-1.uceprotect.net
dig +short A ${REV}.dnsbl-2.uceprotect.net
dig +short A ${REV}.dnsbl-3.uceprotect.net

# SORBS composite
dig +short A ${REV}.dnsbl.sorbs.net
dig +short TXT ${REV}.dnsbl.sorbs.net

Spamhaus’s web check (check.spamhaus.org) and MXToolbox’s blocklist check are useful for a one-click overview, but the dig queries above are authoritative.

Check your outbound MTA logs for the listed time window — what was being sent, from which authenticated account, to which destinations, at what rate.

For Postfix:

# Last 30 min of outbound rejections related to the IP
journalctl -u postfix --since "30 min ago" \
  | grep -E "${IP}|bounced|reject" | tail -100

# Top sender accounts by volume in last hour
awk '/sasl_username=/{print $NF}' /var/log/maillog \
  | tail -10000 \
  | sed 's/.*sasl_username=//;s/ .*//' \
  | sort | uniq -c | sort -rn | head -20

A single sender account producing several hundred recipients in the last hour, with destinations heavy on Outlook or Gmail, is your prime suspect for cause (1) or (2).

The fix

A four-phase workflow. Do them in order. Do not skip phase 1.

Phase 1 — stop the bleeding (5 minutes)

Pause outbound for the suspicious source while you investigate. If a single account is the source:

# Postfix — disable an authenticated sender
postconf -e "smtpd_sender_login_maps = hash:/etc/postfix/sender_login_maps"
echo "compromised@example.com REJECT" >> /etc/postfix/sender_login_maps
postmap /etc/postfix/sender_login_maps
postfix reload

# Or, faster: freeze the SASL account at the auth backend
# (Dovecot, LDAP, whichever you use)

If multiple accounts on the same IP are suspect, divert outbound from that IP entirely:

# Route all outbound through a clean IP temporarily
postconf -e "smtp_bind_address = 198.51.100.20"
postfix reload

You’re now sending from a different IP. The customer experience is preserved while you debug the listed one.

Phase 2 — identify and remediate the cause

For each listing reason, the remediation:

Spamhaus CBL/XBL (127.0.0.4): The IP is exploited — there is a botnet client or open relay on the host. Audit:

# Open relay test from outside
swaks --to test@external-recipient.example \
      --from sender@example.com \
      --server ${IP} \
      --suppress-data --auth-user '' --auth-password ''

# Anything that doesn't fail at AUTH means an unauthenticated relay path

# Check for outbound spam at the source
ss -tnp | grep ':25 ' | head -50
ps auxww | grep -E 'perl|python|.sh' | grep -v grep

Patch what you find: shut down the rogue process, change SASL credentials of suspect accounts, force-rotate keys, run rkhunter --check and a malware scan on the host.

Spamhaus SBL/CSS: Manual listing — a Spamhaus researcher believes you are sending unsolicited mail, often based on spamtrap hits or complaint volume. Open the Spamhaus SBL record in their tracker (the URL is in the TXT response) and read the evidence. You need a documented response: which list segment was responsible, how it was acquired, what consent records you have, what suppression you’ve added since.

UCEPROTECT L1: Self-cleaning. UCEPROTECT delists L1 automatically seven days after the last detected event. If you want it faster, they require a “Whitelist” application that costs a fee — many operators wait the seven days.

UCEPROTECT L2/L3: You can’t solve this alone. The fix is to get the cleaner L1 entries off the /24 (and L2 will lift once enough L1s in the range are clean), or to move to a different IP block. Contact your IP provider.

SORBS: Read the listing reason in the TXT record. SORBS zones include spam.dnsbl.sorbs.net (spam evidence), dul.dnsbl.sorbs.net (dynamic IP), smtp.dnsbl.sorbs.net (open relay), web.dnsbl.sorbs.net (web-form abuse). Fix the underlying issue, then file via their form.

Phase 3 — file the delisting

Each list has a different submission process and different criteria.

Spamhaus:

https://www.spamhaus.org/lookup/

Search for your IP, click through to the listing detail, click the delisting button. Spamhaus reads the form. Generic responses (“please remove”) are rejected. Include: the root cause, the specific remediation, and the timestamp of when the remediation went live. They will retest before delisting. Realistic turnaround: 24–48 hours if the cause is fixed.

For CBL/XBL specifically, the auto-delisting process at cbl.abuseat.org retests on submission — if the abuse signature is gone, removal is automatic and immediate. If it isn’t gone, the request bounces and the IP gets a backoff timer.

UCEPROTECT:

https://www.uceprotect.net/en/index.php?m=3&s=4

L1 auto-clears in 7 days. If you must accelerate, the paid express delisting is on the same page. Do not file unless the underlying volume problem is resolved — re-listing within the express window does not refund.

SORBS:

https://www.sorbs.net/delisting/

Submit the IP, the zone you’re listed in, and the remediation. SORBS turnaround is the slowest of the three — 1–7 days is normal. Their automated form does not always notify on completion; recheck with dig daily.

Phase 4 — verify and prevent recurrence

# Confirm delisting across all three
for L in zen.spamhaus.org dnsbl-1.uceprotect.net dnsbl.sorbs.net; do
  R=$(dig +short A ${REV}.${L})
  echo "${L}: ${R:-clean}"
done
# zen.spamhaus.org: clean
# dnsbl-1.uceprotect.net: clean
# dnsbl.sorbs.net: clean

Then revert the temporary mitigation from Phase 1:

postconf -e "smtp_bind_address ="
postfix reload

Add a recurring check to your monitoring loop so you catch the next listing within minutes, not hours:

#!/usr/bin/env bash
# /usr/local/bin/blocklist-check.sh — run every 5 min via cron
set -euo pipefail
IPS=("203.0.113.45" "203.0.113.46" "203.0.113.47")
LISTS=("zen.spamhaus.org" "dnsbl-1.uceprotect.net" "dnsbl.sorbs.net" "bl.spamcop.net")
TARGET=/var/lib/node_exporter/textfile_collector/blocklist.prom

{
  echo "# HELP mail_ip_blocklisted 1 if listed, 0 if clean"
  echo "# TYPE mail_ip_blocklisted gauge"
  for IP in "${IPS[@]}"; do
    REV=$(echo "${IP}" | awk -F. '{print $4"."$3"."$2"."$1}')
    for L in "${LISTS[@]}"; do
      R=$(dig +short A "${REV}.${L}" @8.8.8.8)
      V=0; [[ -n "${R}" ]] && V=1
      echo "mail_ip_blocklisted{ip=\"${IP}\",list=\"${L}\"} ${V}"
    done
  done
} > "${TARGET}.tmp"
mv "${TARGET}.tmp" "${TARGET}"

Alert on mail_ip_blocklisted == 1 for >5 minutes. That gives you a real-time signal and an audit trail.

Prevent recurrence:

  • Suspend outbound from any account exceeding a threshold (e.g. 200 recipients in 5 minutes) until reviewed.
  • Rate-limit per-account outbound at the MTA.
  • Require DMARC enforcement on the sending domain.
  • Watch the Spamhaus DBL (domain blocklist) the same way — domain reputation can move faster than IP reputation.

Stack Harbor runs the detect-classify-delist loop as part of operational mail work under environment management, with the monitoring and alert routing wired into our support plane — open a triage with our team when a listing has already hit and you need help before the queue burns.