From d5700842eb19588d1a741437d301771cbcfa0977 Mon Sep 17 00:00:00 2001 From: BigBodyCobain <43977454+BigBodyCobain@users.noreply.github.com> Date: Tue, 17 Nov 2026 02:41:47 -0700 Subject: [PATCH] Malware C2: drop the URLhaus supplement, say when Feodo has gone quiet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit URLhaus now needs an Auth-Key, and its recent-URL entries carry no country. The old code put every country-less entry on the first centroid in the table (Afghanistan) and read a field name the API doesn't use, so a key alone would have stacked 100 dots over Afghanistan. The layer is now Feodo Tracker only. Feodo can go months without listing a new C2 server, which left the layer showing a few old dots and looking broken. The fetcher now reports the newest last_online among the plotted servers, and the layer panel's source line reads "abuse.ch · none new since " once that is two weeks old, or "no C2 servers listed" when the list is empty. README, the OpenClaw skill doc and two code comments no longer mention URLhaus. Co-Authored-By: Claude Opus 5.5 --- README.md | 10 +-- backend/services/fetchers/malware.py | 44 +++---------- backend/tests/test_malware_feodo_only.py | 62 +++++++++++++++++++ .../__tests__/lib/malwareFeedLabel.test.ts | 37 +++++++++++ frontend/src/components/MaplibreViewer.tsx | 2 +- .../src/components/WorldviewLeftPanel.tsx | 3 +- .../src/components/map/geoJSONBuilders.ts | 2 +- frontend/src/lib/malwareFeedLabel.ts | 39 ++++++++++++ frontend/src/types/dashboard.ts | 2 + openclaw-skills/shadowbroker/SKILL.md | 2 +- 10 files changed, 160 insertions(+), 43 deletions(-) create mode 100644 backend/tests/test_malware_feodo_only.py create mode 100644 frontend/src/__tests__/lib/malwareFeedLabel.test.ts create mode 100644 frontend/src/lib/malwareFeedLabel.ts diff --git a/README.md b/README.md index b87b6832..6effc8c6 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ ShadowBroker includes an optional **Shodan connector** for operator-supplied API * **Run a full recon toolkit** from the left sidebar — IP geolocation, DNS, RDAP/WHOIS, certificate transparency, BGP/ASN, OFAC sanctions search, CVE lookup, Tor/OTX threat checks, and subnet sweeps (InternetDB proxied server-side) * **Expand an entity graph** when you select an aircraft, vessel, company, or IP — Wikidata + OFAC + live store cross-links rendered in the Entity Graph panel * **Monitor supply-chain risk** — Tier 1/2 semiconductor and battery fabs scored against nearby earthquakes, wildfires, and conflict events (SCM panel) -* **Toggle malware C2 hotspots** — abuse.ch Feodo Tracker + URLhaus feeds mapped by country (opt-in layer) +* **Toggle malware C2 hotspots** — abuse.ch Feodo Tracker botnet C2 servers mapped by country (opt-in layer) * **Monitor Telegram OSINT channels** — public `t.me/s` war/conflict feeds (OSINTdefender, NEXTA, etc.) scraped hourly, risk-scored, geoparsed to metro anchors, and plotted as clickable map pins with inline media * **Overlay global submarine cables** — static TeleGeography-derived cable routes (opt-in layer) @@ -407,7 +407,7 @@ Adapted from the [OSIRIS](https://github.com/simplifaisoul/osiris) recon stack ( * **Military Bases** — Global military installation and missile facility database (NEW) * **Power Plants** — 35,000+ global power plants from the WRI database (NEW) * **Submarine Cables** — Global undersea cable routes from static TeleGeography-derived GeoJSON (`frontend/public/data/submarine-cables.json`). Opt-in line overlay. -* **Malware C2 Layer** — Botnet C2 servers (Feodo Tracker) and recent malware URLs (URLhaus) from abuse.ch, refreshed on the slow tier when the layer is enabled. +* **Malware C2 Layer** — Botnet C2 servers from abuse.ch's Feodo Tracker, refreshed on the slow tier when the layer is enabled. When Feodo hasn't listed a new server in two weeks, the layer panel says since when. * **SCM Supplier Risk** — Tier 1/2 fabs and battery plants (TSMC, Samsung, CATL, etc.) cross-referenced against earthquakes, FIRMS fires, and GDELT conflict proximity. Alerts in the SCM panel; optional map layer. * **Cyber Threats Feed** — Recent CISA Known Exploited Vulnerabilities (KEV) entries exposed via `/api/cyber-threats` and the layer toggle. * **Country Risk Index** — Static geopolitical risk scores with USGS earthquake enrichment via `/api/country-risk`. @@ -618,7 +618,7 @@ ShadowBroker v0.9.7 is composed of three vertically-stacked planes — the **Ope | [DeepState Map](https://deepstatemap.live) | Ukraine frontline | ~30min | No | | [Shodan](https://www.shodan.io) | Internet-connected device search | On-demand | **Yes** | | [OpenSanctions](https://www.opensanctions.org) | OFAC SDN sanctions index (recon + entity graph) | 24h cache | No | -| [abuse.ch Feodo + URLhaus](https://abuse.ch) | Malware C2 / distribution URLs | ~5min (opt-in layer) | No | +| [abuse.ch Feodo Tracker](https://feodotracker.abuse.ch) | Botnet C2 servers | ~5min (opt-in layer) | No | | [CISA KEV](https://www.cisa.gov/known-exploited-vulnerabilities-catalog) | Known exploited CVEs | ~5min (opt-in layer) | No | | [ip-api.com](https://ip-api.com) | IP geolocation (recon, entity graph) | On-demand | No | | [Google Public DNS](https://dns.google) | DNS-over-HTTPS lookups (recon) | On-demand | No | @@ -981,7 +981,7 @@ All 41 layers are independently toggleable from the left panel: | Shodan Overlay | ❌ OFF | Internet device search results | | Road Freight Trends | ❌ OFF | Sentinel-2 truck-motion trends on major highways (Analyze Here) | | Submarine Cables | ❌ OFF | Global undersea cable routes (static GeoJSON) | -| Malware C2 | ❌ OFF | abuse.ch Feodo + URLhaus threat points | +| Malware C2 | ❌ OFF | abuse.ch Feodo Tracker C2 points | | SCM Suppliers | ❌ OFF | Tier 1/2 supply-chain risk markers + panel alerts | | Cyber Threats | ❌ OFF | Recent CISA KEV entries (stats in slow-tier payload) | | Telegram OSINT | ✅ ON | Public war/OSINT Telegram channels — hourly scrape, geoparsed pins | @@ -1046,7 +1046,7 @@ Shadowbroker/ │ │ ├── osint_intel/resolve.py # Entity graph resolver (Wikidata + OFAC) │ │ ├── scm/suppliers.py # Supply-chain risk overlay │ │ ├── intel_feeds/ # Country risk index helpers -│ │ ├── fetchers/malware.py # abuse.ch Feodo + URLhaus +│ │ ├── fetchers/malware.py # abuse.ch Feodo Tracker │ │ ├── fetchers/cyber_status.py # CISA KEV feed │ │ ├── fetchers/telegram_osint.py # Public Telegram channel scrape + geoparse │ │ ├── third_party/osiris/ # MIT attribution for Osiris-derived code diff --git a/backend/services/fetchers/malware.py b/backend/services/fetchers/malware.py index 3c83ff31..a130a763 100644 --- a/backend/services/fetchers/malware.py +++ b/backend/services/fetchers/malware.py @@ -1,4 +1,9 @@ -"""Malware C2 / URLhaus feed (abuse.ch, Osiris port).""" +"""Malware C2 feed: abuse.ch Feodo Tracker botnet C2 servers (Osiris port). + +URLhaus used to supplement this layer, but its API needs an Auth-Key since +October 2026 and its entries carry no country, so they can't be placed on +the map without a separate geolocation lookup. The layer is Feodo only. +""" from __future__ import annotations import logging @@ -63,43 +68,14 @@ def fetch_malware_threats() -> list[dict[str, Any]]: except Exception as exc: logger.warning("Feodo fetch failed: %s", exc) - try: - resp = fetch_with_curl( - "https://urlhaus-api.abuse.ch/v1/urls/recent/limit/100/", - timeout=8, - ) - if resp.status_code == 200: - urls = (resp.json() or {}).get("urls") or [] - for u in urls: - cc = u.get("country") - if not cc or cc not in COUNTRY_CENTROIDS: - cc = next(iter(COUNTRY_CENTROIDS)) - lng, lat = COUNTRY_CENTROIDS[cc] - j_lng = ((threat_id * 137.3) % 200 - 100) / 100 * 5 - j_lat = ((threat_id * 211.7) % 200 - 100) / 100 * 5 - threats.append( - { - "id": f"urlhaus-{threat_id}", - "lat": lat + j_lat, - "lng": lng + j_lng, - "ip": u.get("host") or "unknown", - "port": 0, - "malware": ", ".join(u.get("tags") or []) or u.get("threat") or "malware", - "status": u.get("url_status") or "online", - "first_seen": u.get("dateadded"), - "country": cc, - "threat_type": "malware_url", - } - ) - threat_id += 1 - except Exception as exc: - logger.debug("URLhaus supplement failed: %s", exc) - payload = { "threats": threats, "total": len(threats), "timestamp": datetime.now(timezone.utc).isoformat(), - "source": "abuse.ch Feodo Tracker + URLhaus", + "source": "abuse.ch Feodo Tracker", + # Most recent last_online among the plotted servers, so the UI can say + # when the feed has gone quiet instead of looking broken. + "newest_seen": max((row["last_online"] for row in threats if row.get("last_online")), default=None), } with _data_lock: latest_data["malware_threats"] = payload diff --git a/backend/tests/test_malware_feodo_only.py b/backend/tests/test_malware_feodo_only.py new file mode 100644 index 00000000..9cb2fa14 --- /dev/null +++ b/backend/tests/test_malware_feodo_only.py @@ -0,0 +1,62 @@ +"""Malware C2 layer: Feodo Tracker only, plus the newest last_online for the panel hint.""" + +from services.fetchers import malware + + +class _Resp: + def __init__(self, status_code, payload=None): + self.status_code = status_code + self._payload = payload + + def json(self): + return self._payload + + +FEODO = [ + {"ip_address": "1.2.3.4", "dst_port": 443, "malware": "QakBot", "status": "offline", + "first_seen": "2026-01-02 10:00:00", "last_online": "2026-03-05", "country": "US"}, + {"ip_address": "5.6.7.8", "dst_port": 8080, "malware": "Emotet", "status": "offline", + "first_seen": "2026-02-01 10:00:00", "last_online": "2026-03-12", "country": "GB"}, + {"ip_address": "9.9.9.9", "dst_port": 80, "malware": "Pikabot", "status": "offline", + "first_seen": "2026-02-01 10:00:00", "last_online": "2026-03-20", "country": "ZZ"}, +] + + +def _enable(monkeypatch, fake_fetch): + monkeypatch.setitem(malware.latest_data, "malware_threats", {}) + monkeypatch.setattr(malware, "is_any_active", lambda *_: True) + monkeypatch.setattr(malware, "fetch_with_curl", fake_fetch) + + +def test_only_feodo_is_fetched(monkeypatch): + urls = [] + + def fake_fetch(url, *args, **kwargs): + urls.append(url) + return _Resp(200, FEODO) + + _enable(monkeypatch, fake_fetch) + threats = malware.fetch_malware_threats() + + assert urls == ["https://feodotracker.abuse.ch/downloads/ipblocklist.json"] + assert {t["threat_type"] for t in threats} == {"botnet_c2"} + assert malware.latest_data["malware_threats"]["source"] == "abuse.ch Feodo Tracker" + + +def test_newest_seen_is_the_latest_plotted_server(monkeypatch): + _enable(monkeypatch, lambda *a, **k: _Resp(200, FEODO)) + malware.fetch_malware_threats() + + payload = malware.latest_data["malware_threats"] + # ZZ has no centroid, so its later date is not plotted and not counted. + assert payload["total"] == 2 + assert payload["newest_seen"] == "2026-03-12" + + +def test_newest_seen_is_none_when_feodo_fails(monkeypatch): + _enable(monkeypatch, lambda *a, **k: _Resp(503)) + malware.fetch_malware_threats() + + payload = malware.latest_data["malware_threats"] + assert payload["total"] == 0 + assert payload["newest_seen"] is None diff --git a/frontend/src/__tests__/lib/malwareFeedLabel.test.ts b/frontend/src/__tests__/lib/malwareFeedLabel.test.ts new file mode 100644 index 00000000..a2fcae15 --- /dev/null +++ b/frontend/src/__tests__/lib/malwareFeedLabel.test.ts @@ -0,0 +1,37 @@ +import { describe, expect, it } from 'vitest'; + +import { malwareSourceLabel } from '@/lib/malwareFeedLabel'; + +const NOW = new Date('2026-11-17T12:00:00Z'); + +describe('malwareSourceLabel', () => { + it('stays plain before the first fetch', () => { + expect(malwareSourceLabel(undefined, NOW)).toBe('abuse.ch'); + }); + + it('says so when the feed lists nothing', () => { + expect(malwareSourceLabel({ total: 0, newest_seen: null }, NOW)).toBe( + 'abuse.ch · no C2 servers listed', + ); + }); + + it('stays plain while the newest server is recent', () => { + expect(malwareSourceLabel({ total: 12, newest_seen: '2026-11-10' }, NOW)).toBe('abuse.ch'); + }); + + it('names the month once the feed has been quiet for two weeks', () => { + expect(malwareSourceLabel({ total: 5, newest_seen: '2026-03-12' }, NOW)).toBe( + 'abuse.ch · none new since Mar 2026', + ); + }); + + it('reads the timestamp form too', () => { + expect(malwareSourceLabel({ total: 5, newest_seen: '2026-03-12 08:15:00' }, NOW)).toBe( + 'abuse.ch · none new since Mar 2026', + ); + }); + + it('ignores a date it cannot read', () => { + expect(malwareSourceLabel({ total: 5, newest_seen: 'soon' }, NOW)).toBe('abuse.ch'); + }); +}); diff --git a/frontend/src/components/MaplibreViewer.tsx b/frontend/src/components/MaplibreViewer.tsx index 49226745..dae25a22 100644 --- a/frontend/src/components/MaplibreViewer.tsx +++ b/frontend/src/components/MaplibreViewer.tsx @@ -4055,7 +4055,7 @@ const MaplibreViewer = ({ /> - {/* Malware C2 — abuse.ch Feodo + URLhaus */} + {/* Malware C2 — abuse.ch Feodo Tracker */} }, diff --git a/frontend/src/lib/malwareFeedLabel.ts b/frontend/src/lib/malwareFeedLabel.ts new file mode 100644 index 00000000..57be9aca --- /dev/null +++ b/frontend/src/lib/malwareFeedLabel.ts @@ -0,0 +1,39 @@ +/** + * Source line for the Malware C2 layer in the layer panel. + * + * Feodo Tracker can go weeks or months without listing a new botnet C2 + * server. When that happens the layer shows a handful of old dots and looks + * broken, so the source line says how long the feed has been quiet. + */ + +const QUIET_AFTER_DAYS = 14; +const DAY_MS = 86_400_000; + +export interface MalwareFeedSummary { + total?: number; + newest_seen?: string | null; +} + +function parseSeen(value: string): Date | null { + // Feodo gives "YYYY-MM-DD" or "YYYY-MM-DD HH:MM:SS" (UTC). + const iso = /^\d{4}-\d{2}-\d{2}$/.test(value) + ? `${value}T00:00:00Z` + : /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(value) + ? `${value.replace(' ', 'T')}Z` + : value; + const date = new Date(iso); + return Number.isNaN(date.getTime()) ? null : date; +} + +export function malwareSourceLabel( + feed: MalwareFeedSummary | null | undefined, + now: Date = new Date(), +): string { + if (!feed) return 'abuse.ch'; + if (!feed.total) return 'abuse.ch · no C2 servers listed'; + const seen = feed.newest_seen ? parseSeen(feed.newest_seen) : null; + if (!seen) return 'abuse.ch'; + if ((now.getTime() - seen.getTime()) / DAY_MS < QUIET_AFTER_DAYS) return 'abuse.ch'; + const since = seen.toLocaleString('en-US', { month: 'short', year: 'numeric', timeZone: 'UTC' }); + return `abuse.ch · none new since ${since}`; +} diff --git a/frontend/src/types/dashboard.ts b/frontend/src/types/dashboard.ts index e799008c..435cd054 100644 --- a/frontend/src/types/dashboard.ts +++ b/frontend/src/types/dashboard.ts @@ -945,6 +945,8 @@ export interface DashboardData { total?: number; timestamp?: string | null; source?: string; + /** Most recent last_online among the listed C2 servers. */ + newest_seen?: string | null; }; cyber_threats?: { threats?: Array<{ diff --git a/openclaw-skills/shadowbroker/SKILL.md b/openclaw-skills/shadowbroker/SKILL.md index 84034ac8..197d1a42 100644 --- a/openclaw-skills/shadowbroker/SKILL.md +++ b/openclaw-skills/shadowbroker/SKILL.md @@ -236,7 +236,7 @@ Every layer returns maximum telemetry. Key enriched fields: | **Earthquakes** | `lat`, `lng`, `magnitude`, `depth`, `place`, `time` | | **Correlations** | `type`, `severity`, `score`, `lat`, `lng`, `drivers` (triggering layers) | | **Telegram OSINT** | `title`, `description`, `channel`, `source`, `link`, `published`, `risk_score`, `coords` `[lat, lng]` | -| **Malware Threats** | `ip`, `malware`, `threat_type`, `status`, `country`, `lat`, `lng` (Feodo + URLhaus) | +| **Malware Threats** | `ip`, `malware`, `threat_type`, `status`, `country`, `lat`, `lng` (Feodo Tracker) | | **Cyber Threats** | `id` (CVE), `name`, `vendor`, `product`, `severity`, `date` (CISA KEV) | | **SCM Suppliers** | `name`, `city`, `country`, `category`, `risk_level`, `active_threats`, `lat`, `lng` |