Описание
Dragonfly Manager Job API Unauthenticated Access
Summary
Dragonfly Manager's Job REST API endpoints lack authentication, allowing unauthenticated attackers to create, query, modify, and delete jobs, potentially leading to resource exhaustion, information disclosure, and service disruption.
Affected Products
- Product: Dragonfly
- Component: Manager (REST API)
- Affected Versions: v2.x (based on source code analysis, including v2.4.0)
- Affected Endpoints:
/api/v1/jobs
Vulnerability Details
Description
Dragonfly Manager's Job API endpoints (/api/v1/jobs) lack JWT authentication middleware and RBAC authorization checks in the routing configuration. This allows any unauthenticated user with access to the Manager API to perform the following operations:
- List all jobs (GET
/api/v1/jobs) - Create new jobs (POST
/api/v1/jobs) - Query job details (GET
/api/v1/jobs/:id) - Modify jobs (PATCH
/api/v1/jobs/:id) - Delete jobs (DELETE
/api/v1/jobs/:id)
Technical Root Cause
In the source code file manager/router/router.go at lines 204-211, the Job API route group lacks authentication middleware:
In contrast, other API endpoints (such as /clusters) are correctly configured with authentication:
The developer left a TODO comment in the code, indicating this is a known but unresolved issue.
Proof of Concept
Environment Setup
Prerequisites
- Kubernetes cluster (Kind/Minikube/GKE, etc.)
- Helm 3.8.0+
- kubectl
- curl and jq
Deployment Steps
- Add Dragonfly Helm Repository
- Generate Deployment Manifest
- Deploy to Kubernetes
Expected Output:
- Setup Port Forwarding
Exploitation Steps
Step 1: Verify Unauthenticated Access
Command:
Actual Output:
HTTP Status Code: 200 OK
Analysis: The API returns a successful response instead of 401 Unauthorized, confirming the lack of authentication.
Step 2: Create Unauthorized Job
Command:
Actual Output:
HTTP Status Code: 200 OK
Analysis: Successfully created a Job (ID: 2) without any authentication token.
Step 3: Query Job Details
Command:
Actual Output:
HTTP Status Code: 200 OK
Step 4: Modify Job
Command:
Actual Output:
HTTP Status Code: 200 OK
Step 5: Delete Job
Command:
Actual Output:
HTTP Status Code: 200 OK
Step 6: Comparison Test - Authenticated Endpoint
Command:
Actual Output:
HTTP Status Code: 401 Unauthorized
Analysis: This proves that the authentication mechanism itself is working correctly; only the Job API endpoints are missing the configuration.
Automated POC Script
Complete automated verification script available at:
- Script:
poc.sh - Output Log:
poc_output.log
Execution Summary:
Impact Analysis
Direct Impact
- Unauthorized Job Management: Attackers can fully control the Job lifecycle (CRUD operations)
- Information Disclosure: Can query all jobs, potentially exposing internal URLs, configurations, and business logic
- Service Disruption: Can delete legitimate jobs, affecting normal file distribution services
- Resource Exhaustion: Can create massive numbers of jobs leading to system resource exhaustion (DoS)
Potential Attack Scenarios
- Resource Exhaustion Attack
-
SSRF Risk: Through the URL parameter of Preheat jobs, SSRF attacks may be triggered (although there is SafeDialer protection, risks still exist)
-
Business Logic Disruption: Delete or modify critical jobs, affecting CDN preheating and file distribution functionality
Affected Deployment Scenarios
- Manager API exposed on the public internet or untrusted networks
- Malicious users or compromised systems in internal networks
- Tenant isolation failures in multi-tenant environments
Remediation
Recommended Fix
Add authentication and authorization middleware to the Job API in the manager/router/router.go file:
Temporary Mitigation
Before the fix is released, the following mitigation measures can be taken:
-
Network Isolation: Restrict network access to the Manager API
- Use firewall rules to limit source IPs
- Only allow trusted internal networks to access
- Use Kubernetes NetworkPolicy to restrict Pod-to-Pod communication
-
API Gateway: Deploy an API gateway in front of Manager for authentication
- Use reverse proxies like Nginx/Kong/Traefik
- Configure OAuth2/JWT validation
-
Monitoring and Alerting: Monitor abnormal access patterns to Job API
- Log all Job API calls
- Set up alerts for abnormal job creation/deletion
Verify Fix
After the fix, all unauthenticated requests should return 401 Unauthorized:
Expected Output:
Appendix: Complete Verification Logs
Deployment Verification Logs
POC Execution Complete Logs
See poc_output.log file for details.
Patches
- Dragonfy v2.4.1 and above.
Workarounds
There are no effective workarounds, beyond upgrading.
Пакеты
d7y.io/dragonfly/v2
< 2.4.1
2.4.1
Связанные уязвимости
Dragonfly is an open source P2P-based file distribution and image acceleration system. In versions 2.4.1-rc.0 and below, the Job API endpoints (/api/v1/jobs) lack JWT authentication middleware and RBAC authorization checks in the routing configuration. This allows any unauthenticated user with access to the Manager API to view, update and delete jobs. The issue is fixed in version 2.4.1-rc.1.