Sign up Log in
n/ai · 13m ago · 22 views
u/honestTaiSilverVerified merchant
n/aiu/honestTai Verified merchant · 13m ago

Late-night honeypot red alert saved my skin: a gateway injection, a cross-site manhunt, and a 15-hour full-stack counterstrike

Last night at 10:30 p.m., I just wanted to quickly lock down port 22 on an old business server, switch it to pure SSH key login, and go to bed.

Who knew that one command opening /var/log/auth.log would completely kill any chance of sleep that night.


Checked the logs before bed and my blood ran cold

The terminal quietly scrolled a string of shocking records: from 01:11 to 09:26 that day, the root account on this machine had been successfully logged into with passwords 75 times, from 4 unfamiliar overseas IPs. Then I checked /tmp, and the temp directory still had leftover .sql database query scripts and brute-force tools that hadn't been cleaned up.

Even more dramatic was what showed up on another monitor.

Just as I was about to investigate how much data had been taken from this machine, I switched to the admin dashboard of another completely independent system I had on hand to glance at monitoring—that system had previously set up login honeypots, fake response decoys, and device/request fingerprint blocking to stop spam.

The log page immediately lit up with a bunch of glaring red labels: Honeypot · Disguised 403, Blocked, Honeypot · Disguised 429.

I checked the timeline and source IPs carefully and instantly woke up: from around 4 to 5 a.m., someone kept rotating IPv6 and overseas nodes to throw in time-based blind SQL injection probes like zz' and pg_sleep(5)[email protected], and stepped right into honeypot beacons (non-browser client intercepted by honeypot), eating several fake 403s. By 09:31:11, a disturbingly familiar IP (45.196.236.41) also showed up on the blocklist—it was one of the main attack sources that had logged into the root account of my other business server and stolen the cloud account key the night before!

And even earlier, at 2:30 a.m., the attacker had already used the admin's real name, backend account, and database username from the business DB's user table to try a round of passwords across systems; by 10:30 the next morning, these scripts were still rotating curl and spoofing Firefox 158, using [email protected] to probe their way in.

Two systems that had nothing to do with each other had a terrifying rendezvous in the red alerts that night: the attacker had already breached the old business server's entry point and, holding the identity and credential puzzle pieces they'd pulled out, was hunting across sites along the developer's public footprint.


Reconstructing the attacker's playbook: no god-tier 0-day, just the keys we handed over ourselves

Too wired to sleep, I lined up Nginx access logs, filesystem atime timestamps, and cloud ActionTrail audit logs line by line overnight. Once the whole attack chain was clear, it felt both terrifying and absurd—they hadn't used any fancy 0-day; almost every step followed clues we'd left behind ourselves:

Act one: pulled the main domain from personal homepage metadata

Back when I was messing with a tech showcase page and GitHub profile, for verification and SEO I'd cross-linked sameAs, canonical, and contact email in page metadata. To normal visitors it's a personal business card, but once automated recon scripts get hold of it, toss the developer identifiers, public email, and public Certificate Transparency logs (CT Log) into a mapping engine, and in a few minutes it can stitch your active main domain and full set of business subdomains into one map.

Act two: the open-source scaffold turned into a pentest signpost

I'd open-sourced a stripped-down scaffold repo for convenience. To make local debugging easier, the gateway config had exposure.include: gateway,health,info by default, and the Nginx example config had a rule specifically to "block /gateway/actuator". To a scanning script, that's basically written in black and white: this microservice stack has Spring Cloud Gateway dynamic routing endpoints enabled by default—the only question is whether the outer Nginx blocks them.

Act three: one missed config on the production gateway, into the internal network in seconds (CVE-2022-22947)

Nginx access logs recorded the exact second of the break-in: just after 12:40 a.m., once they'd locked onto the main domain, they first tried a few client activation endpoints that appeared in public code, all 404. Then, almost without pausing, they turned straight to /gateway/actuator/gateway/routes.

As luck would have it, the production gateway had missed that path block due to historical config changes. One hit, and they used SpEL expression injection to forcibly write a temporary dynamic route, exposing the internal config query endpoint within seconds. A string of HTTP 200s later, they'd cleaned out third-party keys in the system config table, the backend admin account list, and even host clues.

Act four: the most terrifying countdown—the 1:26 a.m. cloud asset inventory

If the server password breach was just one machine falling, what really made my heart skip a beat was the next thing I opened: the cloud platform's ActionTrail audit.

Years ago, to make uploading a few product images easier for the middle platform, someone had shoved a cloud vendor root account AccessKey directly into the database config table. The audit records stated it plainly: at 01:26 a.m. and 05:36 a.m., two overseas IPs had already used this highest-privilege Root Key to hit read-only APIs more than 70 times at high frequency—ECS, RDS, OSS, SLS logs, Function Compute, Container Service under the account were almost all called out one by one.

Thankfully, after checking every write operation event in the last 48 hours one by one: they were still stuck at the "inventory cloud assets" stage and hadn't yet created RAM backdoors, dropped databases, or changed DNS records. If I'd found this half a day later, the whole cloud account probably wouldn't have my name on it anymore.


15-hour full-stack counterstrike: from "cut the water and power" to "origin completely hidden"

With all entry points and exposure surfaces clear, I just went with the highest alert assumption—"assume all old credentials are compromised"—and did a full bomb-defusal pass from the cloud account down to the underlying code:

First, kill the Root lifeline and reset every credential

First thing, I went into the cloud console and disabled all root account AccessKeys (actively called the API to retest—all returned 403 AccessKeyDisabled). Then I created a dedicated RAM sub-account with no console login permission, narrowed policy permissions to read/write only a specified bucket and upload certificates, and tied it hard to an acs:SourceIp condition—even if the key leaks again, requests from anywhere other than the production server's fixed egress IP get rejected outright.

On the host side, I wiped the leftover scripts in /tmp, 36 historical .bak files, and old .env files; disabled SSH password login; regenerated a fresh Ed25519 login keypair and server Host Key; tightened the security group's port 22 to only whitelisted admin IPs. I regenerated and replaced MySQL in local Docker (listening only on 127.0.0.1:3306), Redis (127.0.0.1:6379), the JWT signing key, and TLS private keys for 4 sites, and cleared all historical Redis sessions while I was at it.

Weld the breached door shut at all three layers

  • Config layer: hardcode management.endpoint.gateway.enabled: false across all environments, keep only health in exposure.include, and hide details.
  • JVM gateway layer: add a global request protection Filter to intercept all /actuator requests except local loopback health, close off bypass variants with matrix parameters ;, path traversal .., or double URL encoding, and unconditionally strip externally spoofed internal user headers at the gateway entrance.
  • Nginx entry layer: add a regex "(^|/)actuator(/|;|$)" catch-all cutoff, and also block scan probe paths like .env, .git, .sql, .bak, .php and abandoned old callbacks.

Full-repo minesweep; just cut the high-risk modules that weren't strictly needed

While I was at it, I ran a stricter security baseline across several backend modules and the gateway: changed all the payment and callback signature-skip and empty-key allow settings left over from debugging into Fail-Closed strict validation; added SSRF protection and streaming size limits to remote image sync; expanded full-chain access logs to precise User-Agent and passive request-header fingerprint level, and folded the exception stacks that were flooding the logs across multiple lines online into single readable records.

The most dramatic cut was the AI Agent module built into the system. During static audit, we found another issue in its read-only SQL guard: validation stripped comments first, but execution passed the original string to the database, so MySQL executable comments (/*!50000 ... */) could bypass keyword blocking. Fixed it on the spot, but on second thought, the business backend doesn't really need an Agent with query and ops tools day to day—so I ripped it out root and branch from the backend, gateway, four frontends, and mobile, stopped the service, and cleared the directory. One less high-privilege exposure surface is worth more than ten protection rules stacked in front of it.

The morning counterattack, and finally "hiding the origin in the edge nodes"

After fiddling until past 2 a.m., I barely slept a few hours. At 07:13 the next morning, when I checked the logs, the dramatic scene played out again—that overseas attack IP from last night really did come back for another round, probing /gateway/actuator/gateway/routes 28 times in a row. This time they all got a zero-byte 444 at the first Nginx layer and were cut off, never even touching the gateway. By 10:23 a.m., the bypass system's honeypot was still holding requests rotating between curl and Firefox 158 safely outside at 429.

But as long as the origin's real IP is still exposed on the public internet, they can just switch to a pool of domestic proxies and hit the machine's front door again. So in the morning I went all in and moved the whole site behind Alibaba Cloud ESA (Basic), plus cloud DNS and ECS security groups, for a thorough "origin invisibility" setup:

  • Lock the security group down to edge back-to-origin ranges: enabled origin protection in ESA, got 146 official back-to-origin IPv4 ranges, put them into an ECS security group prefix list, allowed only those back-to-origin IPs to access 443, and completely closed public access to port 80. Now scanning the origin IP directly just gets packets dropped at the network layer.
  • 48-character secret header + edge WAF: ESA injects a 48-character random X-Origin-Auth validation header on all back-to-origin requests; origin Nginx returns 444 if it doesn't validate. At the edge, enabled managed WAF rules (27 basic protection rules), common scan probe blocking (.env/.git/wp-login/actuator), edge blocking for traffic outside mainland China (exempting only signed payment callback paths), and CC rate limiting on dynamic APIs.
  • Reduce search index exposure: added X-Robots-Tag: noindex, nofollow, noarchive and full-path Disallow: / in robots.txt for business and admin domains.

In the afternoon I tested /wp-login.php, /.env, and /actuator/health with curl; they all returned 403 right at the edge. Normal business APIs and admin backend all passed, and the server logs finally went completely quiet.


After the terrifying 15 hours, three iron rules I'm keeping for myself

  1. Never put a root account AK/SK in a business config table: even if it's just for image uploads, create a separate least-privilege RAM sub-account and bind it to source IPs; otherwise one hole on the business side and your entire cloud estate gets wiped.
  2. Never rely on Nginx alone to block Spring Actuator: miss a semicolon matrix parameter or route prefix and CVE-2022-22947 will skewer the whole stack in one go; the safest approach is always to hard-disable it at both the config layer and a JVM Filter.
  3. Put more honeypot alerts in bypass systems, and always hide the production origin behind an edge back-to-origin whitelist: often, just as the main business database is being probed, a "honeypot 403 / 429" on a bypass system can sound the life-saving alarm early. Locking the origin security group to only accept edge back-to-origin IPs is what really lets you sleep at night.

Translated by AI from 简体中文

0
2
Log into join the discussion.
海外原生IP VPS,稳定访问全球网络

还在为IP不纯、平台风控、频繁验证而烦恼? 丽萨主机海外原生IP VPS,双ISP住宅IP,覆盖美国、香港、日本、新加坡、台湾、德国、越南、英国等热门地区,适合跨境电商、社媒运营、AI工具、流媒体及海外业务使用。

lisahost.com Learn more

2 replies

Sort order
  1. wxx1337 Silver 12m ago

    Way too advanced, I have no idea what's going on.

    Translated by AI from 简体中文

    0
  2. honestTai Silver OP Verified merchant 3m ago

    Yeah, got injected, they pulled the user table, then brute-forced the password table, then went after my relay site with it — recursive brute-forcing off the password table.

    Translated by AI from 简体中文

    0