mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-12-05 17:13:45 +01:00
Merge pull request #725 from BigBodyCobain/fix/malware-layer-staleness
Malware C2: drop the URLhaus supplement, say when Feodo has gone quiet
This commit is contained in:
10 files changed
+160
-43
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
@@ -4055,7 +4055,7 @@ const MaplibreViewer = ({
|
||||
/>
|
||||
</Source>
|
||||
|
||||
{/* Malware C2 — abuse.ch Feodo + URLhaus */}
|
||||
{/* Malware C2 — abuse.ch Feodo Tracker */}
|
||||
<Source id="malware-source" type="geojson" data={EMPTY_FC} cluster={true} clusterMaxZoom={6} clusterRadius={35}>
|
||||
<Layer
|
||||
id="malware-clusters"
|
||||
|
||||
@@ -59,6 +59,7 @@ import { useTranslation } from '@/i18n';
|
||||
import SarModeChooserModal from './SarModeChooserModal';
|
||||
import KiwiSdrConsentDialog from './ui/KiwiSdrConsentDialog';
|
||||
import { extractGtAlerts } from '@/lib/gtAlerts';
|
||||
import { malwareSourceLabel } from '@/lib/malwareFeedLabel';
|
||||
import {
|
||||
getDefaultLayerSectionExpanded,
|
||||
loadLayerSectionExpanded,
|
||||
@@ -1397,7 +1398,7 @@ const WorldviewLeftPanel = React.memo(function WorldviewLeftPanel({
|
||||
{
|
||||
id: 'malware_c2',
|
||||
name: t('layers.malwareC2'),
|
||||
source: 'abuse.ch',
|
||||
source: malwareSourceLabel(data?.malware_threats),
|
||||
count: data?.malware_threats?.total || 0,
|
||||
icon: Shield,
|
||||
},
|
||||
|
||||
@@ -1718,7 +1718,7 @@ export function buildTelegramOsintGeoJSON(
|
||||
};
|
||||
}
|
||||
|
||||
// ─── Malware C2 / URLhaus ─────────────────────────────────────────────────
|
||||
// ─── Malware C2 (Feodo Tracker) ───────────────────────────────────────────
|
||||
|
||||
export function buildMalwareGeoJSON(
|
||||
payload?: { threats?: Array<{ id: string; lat: number; lng: number; ip: string; malware: string; threat_type?: string; country?: string }> },
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
@@ -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<{
|
||||
|
||||
@@ -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` |
|
||||
|
||||
|
||||
Reference in new issue
Block a user