@dhruviii/attack-path 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,530 @@
1
+ {
2
+ "nodes": [
3
+ {
4
+ "id": "source-3",
5
+ "type": "source",
6
+ "data": {
7
+ "label": "Tata",
8
+ "type": "Source",
9
+ "sourceType": "domain",
10
+ "url": "tatachemicals.com"
11
+ },
12
+ "position": {
13
+ "x": 0,
14
+ "y": 0
15
+ }
16
+ },
17
+ {
18
+ "id": "source-1",
19
+ "type": "source",
20
+ "data": {
21
+ "label": "CoronaRemedies",
22
+ "type": "Source",
23
+ "sourceType": "domain",
24
+ "url": "coronaremedies.com"
25
+ },
26
+ "position": {
27
+ "x": 0,
28
+ "y": 0
29
+ }
30
+ },
31
+ {
32
+ "id": "asset-44",
33
+ "type": "asset",
34
+ "data": {
35
+ "label": "learning.coronaremedies.com",
36
+ "assetType": "webapp",
37
+ "type": "Asset",
38
+ "url": "https://learning.coronaremedies.com:443",
39
+ "riskScore": 41.685330347144465,
40
+ "sources": [
41
+ "CoronaRemedies"
42
+ ],
43
+ "sourceTypes": [
44
+ "domain"
45
+ ]
46
+ },
47
+ "position": {
48
+ "x": 0,
49
+ "y": 0
50
+ }
51
+ },
52
+ {
53
+ "id": "vuln-5",
54
+ "type": "finding",
55
+ "data": {
56
+ "label": "Next.js - Server Side Request Forgery (SSRF)",
57
+ "attackPathCategory": "Attack-Path Candidate",
58
+ "attackPathClass": "attack_path_candidate",
59
+ "confidence": "high",
60
+ "severity": "high",
61
+ "type": "Vulnerability",
62
+ "findingType": "vulnerability",
63
+ "host": "learning.coronaremedies.com",
64
+ "url": "https://learning.coronaremedies.com:443",
65
+ "scheme": "https",
66
+ "port": "443",
67
+ "ip": "52.66.174.151",
68
+ "profile": "cve",
69
+ "templateId": "CVE-2024-34351",
70
+ "description": "Next.Js, inferior to version 14.1.1, have its image optimization built-in component prone to SSRF.\n",
71
+ "matchedAt": "https://learning.coronaremedies.com:443/_next/image?w=16&q=10&url=https://d9adthf0ar0s1ei9mo70y8icmwrgoufkt.oast.site",
72
+ "riskScore": 100,
73
+ "discoveredAt": "2026-07-13"
74
+ },
75
+ "position": {
76
+ "x": 0,
77
+ "y": 0
78
+ }
79
+ },
80
+ {
81
+ "id": "asset-45",
82
+ "type": "asset",
83
+ "data": {
84
+ "label": "learning.coronaremedies.com:3000",
85
+ "assetType": "webapp",
86
+ "type": "Asset",
87
+ "url": "http://learning.coronaremedies.com:3000",
88
+ "port": 3000,
89
+ "riskScore": 40.957446808510646,
90
+ "sources": [
91
+ "CoronaRemedies"
92
+ ],
93
+ "sourceTypes": [
94
+ "domain"
95
+ ]
96
+ },
97
+ "position": {
98
+ "x": 0,
99
+ "y": 0
100
+ }
101
+ },
102
+ {
103
+ "id": "vuln-12",
104
+ "type": "finding",
105
+ "data": {
106
+ "label": "Next.js - Server Side Request Forgery (SSRF)",
107
+ "attackPathCategory": "Attack-Path Candidate",
108
+ "attackPathClass": "attack_path_candidate",
109
+ "confidence": "high",
110
+ "severity": "high",
111
+ "type": "Vulnerability",
112
+ "findingType": "vulnerability",
113
+ "host": "learning.coronaremedies.com",
114
+ "url": "http://learning.coronaremedies.com:3000",
115
+ "scheme": "http",
116
+ "port": "3000",
117
+ "ip": "52.66.174.151",
118
+ "profile": "cve",
119
+ "templateId": "CVE-2024-34351",
120
+ "description": "Next.Js, inferior to version 14.1.1, have its image optimization built-in component prone to SSRF.\n",
121
+ "matchedAt": "http://learning.coronaremedies.com:3000/_next/image?w=16&q=10&url=https://d9aevev0ar0scukp15c0q8ymqfh1af8jr.oast.site",
122
+ "riskScore": 98.54423292273238,
123
+ "discoveredAt": "2026-07-13"
124
+ },
125
+ "position": {
126
+ "x": 0,
127
+ "y": 0
128
+ }
129
+ },
130
+ {
131
+ "id": "asset-142",
132
+ "type": "asset",
133
+ "data": {
134
+ "label": "samarthsarathi.tatachemicals.com",
135
+ "assetType": "webapp",
136
+ "type": "Asset",
137
+ "url": "https://samarthsarathi.tatachemicals.com:443",
138
+ "riskScore": 23.180291153415453,
139
+ "sources": [
140
+ "Tata"
141
+ ],
142
+ "sourceTypes": [
143
+ "domain"
144
+ ]
145
+ },
146
+ "position": {
147
+ "x": 0,
148
+ "y": 0
149
+ }
150
+ },
151
+ {
152
+ "id": "vuln-59",
153
+ "type": "finding",
154
+ "data": {
155
+ "label": "Missing Cookie SameSite Strict",
156
+ "attackPathCategory": "Exposure Signal",
157
+ "attackPathClass": "exposure_signal",
158
+ "confidence": "medium",
159
+ "severity": "info",
160
+ "type": "Vulnerability",
161
+ "findingType": "vulnerability",
162
+ "host": "samarthsarathi.tatachemicals.com",
163
+ "url": "https://samarthsarathi.tatachemicals.com:443",
164
+ "scheme": "https",
165
+ "port": "443",
166
+ "ip": "3.6.46.11",
167
+ "profile": "misconfig",
168
+ "templateId": "missing-cookie-samesite-strict",
169
+ "description": "Identified cookies that lacked the samesite=strict attribute, which prevented enforcement of restrictions on cross-domain cookie transmission.\n",
170
+ "matchedAt": "https://samarthsarathi.tatachemicals.com:443",
171
+ "riskScore": 23.180291153415453,
172
+ "discoveredAt": "2026-07-18"
173
+ },
174
+ "position": {
175
+ "x": 0,
176
+ "y": 0
177
+ }
178
+ },
179
+ {
180
+ "id": "asset-133",
181
+ "type": "asset",
182
+ "data": {
183
+ "label": "digitalmark.tatachemicals.com",
184
+ "assetType": "webapp",
185
+ "type": "Asset",
186
+ "url": "https://digitalmark.tatachemicals.com:443",
187
+ "riskScore": 23.180291153415453,
188
+ "sources": [
189
+ "Tata"
190
+ ],
191
+ "sourceTypes": [
192
+ "domain"
193
+ ]
194
+ },
195
+ "position": {
196
+ "x": 0,
197
+ "y": 0
198
+ }
199
+ },
200
+ {
201
+ "id": "vuln-54",
202
+ "type": "finding",
203
+ "data": {
204
+ "label": "Missing Cookie SameSite Strict",
205
+ "attackPathCategory": "Exposure Signal",
206
+ "attackPathClass": "exposure_signal",
207
+ "confidence": "medium",
208
+ "severity": "info",
209
+ "type": "Vulnerability",
210
+ "findingType": "vulnerability",
211
+ "host": "digitalmark.tatachemicals.com",
212
+ "url": "https://digitalmark.tatachemicals.com:443",
213
+ "scheme": "https",
214
+ "port": "443",
215
+ "ip": "13.126.255.216",
216
+ "profile": "misconfig",
217
+ "templateId": "missing-cookie-samesite-strict",
218
+ "description": "Identified cookies that lacked the samesite=strict attribute, which prevented enforcement of restrictions on cross-domain cookie transmission.\n",
219
+ "matchedAt": "https://digitalmark.tatachemicals.com:443",
220
+ "riskScore": 23.180291153415453,
221
+ "discoveredAt": "2026-07-18"
222
+ },
223
+ "position": {
224
+ "x": 0,
225
+ "y": 0
226
+ }
227
+ },
228
+ {
229
+ "id": "asset-146",
230
+ "type": "asset",
231
+ "data": {
232
+ "label": "trucksetu.tatachemicals.com",
233
+ "assetType": "webapp",
234
+ "type": "Asset",
235
+ "url": "http://trucksetu.tatachemicals.com:80",
236
+ "riskScore": 23.180291153415453,
237
+ "sources": [
238
+ "Tata"
239
+ ],
240
+ "sourceTypes": [
241
+ "domain"
242
+ ]
243
+ },
244
+ "position": {
245
+ "x": 0,
246
+ "y": 0
247
+ }
248
+ },
249
+ {
250
+ "id": "vuln-51",
251
+ "type": "finding",
252
+ "data": {
253
+ "label": "Missing Cookie SameSite Strict",
254
+ "attackPathCategory": "Exposure Signal",
255
+ "attackPathClass": "exposure_signal",
256
+ "confidence": "medium",
257
+ "severity": "info",
258
+ "type": "Vulnerability",
259
+ "findingType": "vulnerability",
260
+ "host": "trucksetu.tatachemicals.com",
261
+ "url": "http://trucksetu.tatachemicals.com:80",
262
+ "scheme": "http",
263
+ "port": "80",
264
+ "ip": "43.204.3.183",
265
+ "profile": "misconfig",
266
+ "templateId": "missing-cookie-samesite-strict",
267
+ "description": "Identified cookies that lacked the samesite=strict attribute, which prevented enforcement of restrictions on cross-domain cookie transmission.\n",
268
+ "matchedAt": "http://trucksetu.tatachemicals.com:80",
269
+ "riskScore": 23.180291153415453,
270
+ "discoveredAt": "2026-07-18"
271
+ },
272
+ "position": {
273
+ "x": 0,
274
+ "y": 0
275
+ }
276
+ },
277
+ {
278
+ "id": "asset-132",
279
+ "type": "asset",
280
+ "data": {
281
+ "label": "his.tatachemicals.com",
282
+ "assetType": "webapp",
283
+ "type": "Asset",
284
+ "url": "http://his.tatachemicals.com:80",
285
+ "riskScore": 23.180291153415453,
286
+ "sources": [
287
+ "Tata"
288
+ ],
289
+ "sourceTypes": [
290
+ "domain"
291
+ ]
292
+ },
293
+ "position": {
294
+ "x": 0,
295
+ "y": 0
296
+ }
297
+ },
298
+ {
299
+ "id": "vuln-49",
300
+ "type": "finding",
301
+ "data": {
302
+ "label": "Missing Cookie SameSite Strict",
303
+ "attackPathCategory": "Exposure Signal",
304
+ "attackPathClass": "exposure_signal",
305
+ "confidence": "medium",
306
+ "severity": "info",
307
+ "type": "Vulnerability",
308
+ "findingType": "vulnerability",
309
+ "host": "his.tatachemicals.com",
310
+ "url": "http://his.tatachemicals.com:80",
311
+ "scheme": "http",
312
+ "port": "80",
313
+ "ip": "13.202.38.60",
314
+ "profile": "misconfig",
315
+ "templateId": "missing-cookie-samesite-strict",
316
+ "description": "Identified cookies that lacked the samesite=strict attribute, which prevented enforcement of restrictions on cross-domain cookie transmission.\n",
317
+ "matchedAt": "http://his.tatachemicals.com:80",
318
+ "riskScore": 23.180291153415453,
319
+ "discoveredAt": "2026-07-18"
320
+ },
321
+ "position": {
322
+ "x": 0,
323
+ "y": 0
324
+ }
325
+ },
326
+ {
327
+ "id": "asset-135",
328
+ "type": "asset",
329
+ "data": {
330
+ "label": "digitaltwins.tatachemicals.com",
331
+ "assetType": "webapp",
332
+ "type": "Asset",
333
+ "url": "https://digitaltwins.tatachemicals.com:443",
334
+ "riskScore": 23.180291153415453,
335
+ "sources": [
336
+ "Tata"
337
+ ],
338
+ "sourceTypes": [
339
+ "domain"
340
+ ]
341
+ },
342
+ "position": {
343
+ "x": 0,
344
+ "y": 0
345
+ }
346
+ },
347
+ {
348
+ "id": "vuln-24",
349
+ "type": "finding",
350
+ "data": {
351
+ "label": "Missing Cookie SameSite Strict",
352
+ "attackPathCategory": "Exposure Signal",
353
+ "attackPathClass": "exposure_signal",
354
+ "confidence": "medium",
355
+ "severity": "info",
356
+ "type": "Vulnerability",
357
+ "findingType": "vulnerability",
358
+ "host": "digitaltwins.tatachemicals.com",
359
+ "url": "https://digitaltwins.tatachemicals.com:443",
360
+ "scheme": "https",
361
+ "port": "443",
362
+ "ip": "13.201.244.85",
363
+ "profile": "misconfig",
364
+ "templateId": "missing-cookie-samesite-strict",
365
+ "description": "Identified cookies that lacked the samesite=strict attribute, which prevented enforcement of restrictions on cross-domain cookie transmission.\n",
366
+ "matchedAt": "https://digitaltwins.tatachemicals.com:443",
367
+ "riskScore": 23.180291153415453,
368
+ "discoveredAt": "2026-07-18"
369
+ },
370
+ "position": {
371
+ "x": 0,
372
+ "y": 0
373
+ }
374
+ },
375
+ {
376
+ "id": "vuln-4",
377
+ "type": "finding",
378
+ "data": {
379
+ "label": "Next.js Middleware Bypass",
380
+ "attackPathCategory": "Attack-Path Candidate",
381
+ "attackPathClass": "attack_path_candidate",
382
+ "confidence": "high",
383
+ "severity": "critical",
384
+ "type": "Vulnerability",
385
+ "findingType": "vulnerability",
386
+ "host": "learning.coronaremedies.com",
387
+ "url": "https://learning.coronaremedies.com:443",
388
+ "scheme": "https",
389
+ "port": "443",
390
+ "ip": "52.66.174.151",
391
+ "profile": "cve",
392
+ "templateId": "CVE-2025-29927",
393
+ "description": "Next.js contains a critical middleware bypass vulnerability affecting versions 11.1.4 through 15.2.2.\nThe vulnerability allows attackers to bypass middleware security controls by sending a specially crafted\n'x-middleware-subrequest' header, which can lead to authorization bypass and other security control circumvention.\n",
394
+ "matchedAt": "https://learning.coronaremedies.com:443",
395
+ "riskScore": 16.7973124300112,
396
+ "discoveredAt": "2026-07-13"
397
+ },
398
+ "position": {
399
+ "x": 0,
400
+ "y": 0
401
+ }
402
+ },
403
+ {
404
+ "id": "vuln-11",
405
+ "type": "finding",
406
+ "data": {
407
+ "label": "Next.js Middleware Bypass",
408
+ "attackPathCategory": "Attack-Path Candidate",
409
+ "attackPathClass": "attack_path_candidate",
410
+ "confidence": "high",
411
+ "severity": "critical",
412
+ "type": "Vulnerability",
413
+ "findingType": "vulnerability",
414
+ "host": "learning.coronaremedies.com",
415
+ "url": "http://learning.coronaremedies.com:3000",
416
+ "scheme": "http",
417
+ "port": "3000",
418
+ "ip": "52.66.174.151",
419
+ "profile": "cve",
420
+ "templateId": "CVE-2025-29927",
421
+ "description": "Next.js contains a critical middleware bypass vulnerability affecting versions 11.1.4 through 15.2.2.\nThe vulnerability allows attackers to bypass middleware security controls by sending a specially crafted\n'x-middleware-subrequest' header, which can lead to authorization bypass and other security control circumvention.\n",
422
+ "matchedAt": "http://learning.coronaremedies.com:3000",
423
+ "riskScore": 16.013437849944008,
424
+ "discoveredAt": "2026-07-13"
425
+ },
426
+ "position": {
427
+ "x": 0,
428
+ "y": 0
429
+ }
430
+ }
431
+ ],
432
+ "edges": [
433
+ {
434
+ "id": "e-source-1-asset-44",
435
+ "source": "source-1",
436
+ "target": "asset-44",
437
+ "label": "accesses"
438
+ },
439
+ {
440
+ "id": "e-asset-44-vuln-5",
441
+ "source": "asset-44",
442
+ "target": "vuln-5",
443
+ "label": "attack_path_candidate"
444
+ },
445
+ {
446
+ "id": "e-source-1-asset-45",
447
+ "source": "source-1",
448
+ "target": "asset-45",
449
+ "label": "accesses"
450
+ },
451
+ {
452
+ "id": "e-asset-45-vuln-12",
453
+ "source": "asset-45",
454
+ "target": "vuln-12",
455
+ "label": "attack_path_candidate"
456
+ },
457
+ {
458
+ "id": "e-source-3-asset-142",
459
+ "source": "source-3",
460
+ "target": "asset-142",
461
+ "label": "accesses"
462
+ },
463
+ {
464
+ "id": "e-asset-142-vuln-59",
465
+ "source": "asset-142",
466
+ "target": "vuln-59",
467
+ "label": "exposes"
468
+ },
469
+ {
470
+ "id": "e-source-3-asset-133",
471
+ "source": "source-3",
472
+ "target": "asset-133",
473
+ "label": "accesses"
474
+ },
475
+ {
476
+ "id": "e-asset-133-vuln-54",
477
+ "source": "asset-133",
478
+ "target": "vuln-54",
479
+ "label": "exposes"
480
+ },
481
+ {
482
+ "id": "e-source-3-asset-146",
483
+ "source": "source-3",
484
+ "target": "asset-146",
485
+ "label": "accesses"
486
+ },
487
+ {
488
+ "id": "e-asset-146-vuln-51",
489
+ "source": "asset-146",
490
+ "target": "vuln-51",
491
+ "label": "exposes"
492
+ },
493
+ {
494
+ "id": "e-source-3-asset-132",
495
+ "source": "source-3",
496
+ "target": "asset-132",
497
+ "label": "accesses"
498
+ },
499
+ {
500
+ "id": "e-asset-132-vuln-49",
501
+ "source": "asset-132",
502
+ "target": "vuln-49",
503
+ "label": "exposes"
504
+ },
505
+ {
506
+ "id": "e-source-3-asset-135",
507
+ "source": "source-3",
508
+ "target": "asset-135",
509
+ "label": "accesses"
510
+ },
511
+ {
512
+ "id": "e-asset-135-vuln-24",
513
+ "source": "asset-135",
514
+ "target": "vuln-24",
515
+ "label": "exposes"
516
+ },
517
+ {
518
+ "id": "e-asset-44-vuln-4",
519
+ "source": "asset-44",
520
+ "target": "vuln-4",
521
+ "label": "attack_path_candidate"
522
+ },
523
+ {
524
+ "id": "e-asset-45-vuln-11",
525
+ "source": "asset-45",
526
+ "target": "vuln-11",
527
+ "label": "attack_path_candidate"
528
+ }
529
+ ]
530
+ }
@@ -0,0 +1,97 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+
3
+ export interface Transform { x: number; y: number; k: number; }
4
+ const MIN_K = 0.12;
5
+ const MAX_K = 2.6;
6
+
7
+ export function usePanZoom(initial: Transform = { x: 0, y: 0, k: 1 }) {
8
+ const [t, setT] = useState<Transform>(initial);
9
+ const ref = useRef<HTMLDivElement | null>(null);
10
+ const drag = useRef<{ x: number; y: number; tx: number; ty: number } | null>(null);
11
+ const [panning, setPanning] = useState(false);
12
+ const anim = useRef<number | null>(null);
13
+
14
+ const onWheel = useCallback((e: WheelEvent) => {
15
+ if (!ref.current) return;
16
+ e.preventDefault();
17
+ const rect = ref.current.getBoundingClientRect();
18
+ const mx = e.clientX - rect.left, my = e.clientY - rect.top;
19
+ setT((p) => {
20
+ const factor = e.deltaY < 0 ? 1.12 : 1 / 1.12;
21
+ const nk = Math.min(MAX_K, Math.max(MIN_K, p.k * factor));
22
+ const s = nk / p.k;
23
+ return { k: nk, x: mx - (mx - p.x) * s, y: my - (my - p.y) * s };
24
+ });
25
+ }, []);
26
+
27
+ useEffect(() => {
28
+ const el = ref.current;
29
+ if (!el) return;
30
+ el.addEventListener("wheel", onWheel, { passive: false });
31
+ return () => el.removeEventListener("wheel", onWheel);
32
+ }, [onWheel]);
33
+
34
+ const onPointerDown = useCallback((e: React.PointerEvent) => {
35
+ if (e.button !== 0) return;
36
+ if ((e.target as HTMLElement).closest("[data-node]")) return;
37
+ drag.current = { x: e.clientX, y: e.clientY, tx: t.x, ty: t.y };
38
+ setPanning(true);
39
+ (e.target as HTMLElement).setPointerCapture?.(e.pointerId);
40
+ }, [t.x, t.y]);
41
+
42
+ const onPointerMove = useCallback((e: React.PointerEvent) => {
43
+ const d = drag.current;
44
+ if (!d) return;
45
+
46
+ setT((p) => ({
47
+ ...p,
48
+ x: d.tx + (e.clientX - d.x),
49
+ y: d.ty + (e.clientY - d.y),
50
+ }));
51
+ }, []);
52
+
53
+ const onPointerUp = useCallback(() => { drag.current = null; setPanning(false); }, []);
54
+
55
+ const zoomBy = useCallback((factor: number) => {
56
+ if (!ref.current) return;
57
+ const rect = ref.current.getBoundingClientRect();
58
+ const mx = rect.width / 2, my = rect.height / 2;
59
+ setT((p) => {
60
+ const nk = Math.min(MAX_K, Math.max(MIN_K, p.k * factor));
61
+ const s = nk / p.k;
62
+ return { k: nk, x: mx - (mx - p.x) * s, y: my - (my - p.y) * s };
63
+ });
64
+ }, []);
65
+
66
+ const animateTo = useCallback((target: Transform) => {
67
+ if (anim.current) cancelAnimationFrame(anim.current);
68
+ const start = performance.now();
69
+ const dur = 460;
70
+ let from: Transform;
71
+ setT((p) => { from = p; return p; });
72
+ const step = (now: number) => {
73
+ const p = Math.min(1, (now - start) / dur);
74
+ const e = 1 - Math.pow(1 - p, 3);
75
+ setT({ x: from!.x + (target.x - from!.x) * e, y: from!.y + (target.y - from!.y) * e, k: from!.k + (target.k - from!.k) * e });
76
+ if (p < 1) anim.current = requestAnimationFrame(step);
77
+ };
78
+ anim.current = requestAnimationFrame(step);
79
+ }, []);
80
+
81
+ const fitTo = useCallback((b: { minX: number; minY: number; maxX: number; maxY: number }, pad = 80) => {
82
+ if (!ref.current) return;
83
+ const rect = ref.current.getBoundingClientRect();
84
+ const w = b.maxX - b.minX + pad * 2, h = b.maxY - b.minY + pad * 2;
85
+ const k = Math.min(MAX_K, Math.max(MIN_K, Math.min(rect.width / w, rect.height / h)));
86
+ animateTo({ k, x: rect.width / 2 - ((b.minX + b.maxX) / 2) * k, y: rect.height / 2 - ((b.minY + b.maxY) / 2) * k });
87
+ }, [animateTo]);
88
+
89
+ const centerOn = useCallback((x: number, y: number, k?: number) => {
90
+ if (!ref.current) return;
91
+ const rect = ref.current.getBoundingClientRect();
92
+ const nk = k ?? Math.max(t.k, 0.9);
93
+ animateTo({ k: nk, x: rect.width / 2 - x * nk, y: rect.height / 2 - y * nk });
94
+ }, [animateTo, t.k]);
95
+
96
+ return { t, ref, panning, onPointerDown, onPointerMove, onPointerUp, zoomBy, fitTo, centerOn };
97
+ }