CVE-2026-71499 CRITICAL 10.0 난이도Difficulty 입문Intro

cf-manager Worker 배포의 검증 없는 URL fetch가 SSRF를 코드 배포로 바꾸는 취약점Unvalidated URL fetch in cf-manager Worker deployment turns SSRF into code deployment

공식 참조Official references: NVDCVE.org

CVE-2026-71499는 cf-manager의 Improper Control of Generation of Code ('Code Injection')(CWE-94) 취약점으로, CVSS 10(CRITICAL)입니다. 영향 버전: < 1.1.2. 수정 버전: 1.1.2.CVE-2026-71499 is an Improper Control of Generation of Code ('Code Injection') (CWE-94) vulnerability in cf-manager, rated CVSS 10 (CRITICAL). Affected: < 1.1.2. Fixed in: 1.1.2.

제품Product cf-manager
영향 버전Affected < 1.1.2
수정 버전Fixed in 1.1.2
심각도Severity CVSS 10 CRITICAL
취약점 유형Weakness CWE-94 Improper Control of Generation of Code ('Code Injection')
공격 조건Attack conditions 원격 (네트워크) · 인증 불필요 · 사용자 상호작용 불필요Remote (network) · No authentication · No user interaction

1. TL;DR

cf-manager는 Cloudflare 자격 증명을 저장해 두고 사용자를 대신해 Worker를 배포하는 대시보드다. 1.1.2 이전 버전의 Worker 배포 라우트는 URL을 입력받아 서버에서 제한 없는 fetch()로 가져온 뒤, 응답 본문을 Worker 스크립트로 Cloudflare에 업로드했다. 이 업로드에는 피해자의 저장된 자격 증명이 사용되었다.

따라서 배포 API를 호출할 수 있는 사람은 서버가 임의의 URL을 가져오게 만들 수 있었다. 여기에는 공격자가 통제하는 JavaScript도 포함되며, 이 코드는 피해자의 Cloudflare 계정에서 실행된다. API_SECRET이 설정되지 않은 경우 인증 미들웨어가 모든 요청을 통과시켰기 때문에 로그인조차 필요 없었다.

이 취약점은 1.1.2에서 수정되었다.

2. Flaw 분류

항목값
주요 CWECWE-94, Improper Control of Generation of Code (NVD 기준). NVD는 CWE-918, Server-Side Request Forgery도 함께 나열한다.
제품 / 영향받는 버전cf-manager (npm), 1.1.2 이전 버전. 1.1.2에서 수정.
영향받는 엔드포인트POST /api/:accountId/workers (multipart 및 JSON 분기)와 POST /api/batch-deploy
공격 벡터네트워크. 공격자가 배포 API에 요청을 보낸다.
영향서버가 공격자가 고른 URL을 가져온다. 공격자가 제공한 JavaScript가 배포되어 피해자의 Cloudflare Workers 계정에서 실행된다. CVSS 3.1은 Scope Changed, 기밀성·무결성·가용성 영향 High로 평가한다.
전제 조건배포 API에 대한 접근 권한, 또는 API_SECRET이 설정되지 않은 경우 인증 자체가 없음. 공격자의 스크립트를 제공하는 URL도 필요하다.
CVSS10.0 Critical, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

3. 근본 원인

근본 원인은 두 부분으로 이루어진 신뢰 경계 실패다.

1. 검증 없는 서버 측 fetch. 권고문은 worker/src/routes/workers.ts의 대략 113, 126, 527번째 줄에서 세 개의 fetch(url) 호출을 지목한다. 이 호출들은 multipart 분기, JSON 분기, batch-deploy 핸들러에 있다. 각 호출은 사용자가 제공한 URL을 아무 검증 없이 그대로 가져온다. 권고문이 나열한 누락된 항목은 다음과 같다.

  • 프로토콜 제한
  • IP 또는 호스트 검증
  • 리다이렉트 보호
  • Content-Type 검증
  • 응답 크기 검증

2. 가져온 콘텐츠를 신뢰하는 코드로 취급. 응답 본문은 scriptContent에 할당되었다. 이후 코드는 이를 계정의 workers/scripts/<name> 엔드포인트로 PUT 요청하여 Cloudflare API에 보냈고, 이때 대시보드에 저장된 자격 증명으로 인증했다. 요청을 보내고 자격 증명을 쥐고 있는 쪽은 서버다. 공격자는 URL만 고르고, 그 URL을 통해 코드를 정한다.

기여 요인: 선택적 인증. 수정 이전의 인증 미들웨어에는 “API_SECRET이 없으면 검사 없이 계속 진행”에 해당하는 코드가 있었다. API_SECRET 설정을 건너뛴 배포 환경에서는 접근할 수 있는 누구에게나 이 라우트가 노출되었다.

CWE-918은 첫 번째 부분을, CWE-94는 두 번째 부분을 설명한다. 둘 중 하나만으로는 위험이 더 낮다. 두 가지가 결합되어 피해자 계정에서의 원격 코드 실행이 가능해진다.

4. 익스플로잇 흐름(개념)

각 단계의 개념만 설명한다. 요청, URL, 페이로드는 포함하지 않는다.

  1. API 접근. 공격자가 배포 라우트를 직접 호출하거나 권한 있는 API 사용자로서 호출한다. API_SECRET이 없는 배포 환경에서는 미들웨어가 인증을 건너뛰었으므로 자격 증명이 필요 없었다.
  2. URL 제공. 공격자는 스크립트 본문 대신 URL을 제출한다. 단일 Worker 라우트의 multipart 또는 JSON 분기나 batch-deploy를 통해 제출한다. 스킴, 대상 호스트, 주소 범위를 검사하는 곳이 없다.
  3. 서버 측 fetch. cf-manager 서버가 해당 URL을 요청한다. URL은 공격자가 통제하는 호스트나 서버만 접근할 수 있는 위치를 가리킬 수 있다.
  4. Worker로 배포. 응답 본문이 Worker 스크립트로 Cloudflare 계정에 업로드된다. 서버는 저장된 자격 증명으로 인증한다.
  5. 실행. Cloudflare가 공격자의 스크립트를 피해자 계정의 Worker로 실행한다.
  1. 배포 API 접근 — API_SECRET 미설정 시 인증 없음
  2. URL 제출 — 검증 없음
  3. 서버 측 fetch — 저장된 자격 증명은 아직 사용되지 않음
  4. 본문을 Worker 스크립트로 업로드 — 피해자 자격 증명
  5. 공격자 JS가 피해자 Workers 계정에서 실행
개념 흐름도 — 실행 가능한 페이로드가 아닙니다

5. 트리거 조건

  • cf-manager 버전이 1.1.2 이전이다.
  • 공격자가 POST /api/:accountId/workers 또는 POST /api/batch-deploy에 접근할 수 있다.
  • 다음 중 하나가 성립한다.
    • 공격자가 배포 API에 대한 정당하거나 탈취한 접근 권한을 가지고 있다.
    • API_SECRET이 설정되지 않아 수정 이전 미들웨어가 인증을 요구하지 않았다.
  • 저장된 자격 증명이 있는 Cloudflare 계정이 대시보드에 하나 이상 구성되어 있다. 없으면 배포 단계에서 인증할 대상이 없다.
  • 서버가 공격자의 URL에 도달할 수 있다. 코드 실행 결과를 얻으려면 공격자가 그곳에서 응답을 제공해야 한다.

API_SECRET을 설정하면 인증 없는 경로는 막히지만, 인증된 경로는 막히지 않는다. 취약한 버전에서는 시크릿을 정당하게 가진 사용자가 여전히 임의의 URL을 제출할 수 있다.

6. 패치 분석

출처: 수정 커밋 934aecb (“fix: SSRF vulnerability in URL-based Worker deployment (v1.1.2)”). workers.ts, auth.ts, CHANGELOG.md의 diff를 읽었다. 새로 추가된 fetchScriptSafely.ts의 diff는 커밋 페이지에 렌더링되지 않았다. 이 파일은 커밋 메시지와 CHANGELOG만을 근거로 설명한다 (REVIEW_NOTES 참조).

호출 지점

패치는 세 개의 단순 호출을 하나의 헬퍼로 교체한다. 대표적인 변경 전후(JSON 분기)는 다음과 같다.

+6−3ts
       const resp = await fetch(body.url);
       if (!resp.ok) return c.json({ error: { code: 'FETCH_ERROR', message: `Failed to fetch script: ${resp.status}` } }, 400);
       scriptContent = await resp.text();
       scriptUrl = body.url;
       try {
         scriptContent = await fetchScriptSafely(body.url, c.env);
       } catch (err: any) {
         return c.json({ error: { code: 'FETCH_ERROR', message: err.message } }, 400);
       }

삭제된 줄이 흐름의 3단계가 일어나던 곳이다. URL이 곧바로 fetch()에 들어가고 본문이 곧바로 scriptContent에 들어갔다. 이제 그 사이에 헬퍼가 있어서, URL, 리다이렉트, 콘텐츠 타입, 크기 중 하나라도 거부되면 배포 없이 오류로 요청이 끝난다.

새 헬퍼가 강제하는 항목

커밋 메시지와 CHANGELOG는 다음 검사를 나열한다.

  • 프로토콜 허용 목록: https:만 허용.
  • 호스트 및 IP 검증: 루프백, 사설, 링크 로컬, 유니크 로컬 주소 범위를 거부.
  • 리다이렉트 보호: redirect: manual을 사용하고, 각 홉마다 Location 헤더를 검증.
  • Content-Type 검증: JavaScript 또는 텍스트 타입만 허용.
  • 응답 크기 제한: 5 MiB.
  • 선택적 URL 소스 허용 목록: 환경 변수 WORKER_DEPLOY_URL_ALLOWLIST로 설정.

이 검사들은 SSRF 측면을 막는다. 선택적 허용 목록은 코드 출처를 제한하는 통제이며, 이는 CWE-94 측면에 해당한다. 설정하지 않으면 JavaScript를 제공하는 공개 https URL은 여전히 허용된다. 이는 설명된 설계에서 따라오는 결과이지만, 구현을 읽어 확인하지는 않았다.

인증 변경

+3−2ts
   const secret = c.env.API_SECRET;
   if (!secret) return next();
   let secret = c.env.API_SECRET;
   // If API_SECRET is not configured, auto-generate a cryptographically random secret
   if (!secret) { ... secret = _autoGeneratedSecret; }

삭제된 return next()가 API_SECRET 미설정을 “인증 없음”으로 만든 부분이다. 패치된 코드는 무작위 시크릿을 생성하고 경고를 로그에 남긴 뒤, 다른 시크릿과 동일하게 이를 요구한다. 코드 주석에 따르면 생성된 시크릿은 다음 Worker 콜드 스타트까지 유지된다.

감사 로깅

deploy 및 batch-deploy 감사 항목은 이제 detail 필드에 url=<source> 또는 source=upload를 기록한다. 이는 공격을 막지는 않지만 사후 조사에 도움이 된다.

7. 탐지·완화

즉시 조치

  • cf-manager를 1.1.2 이상으로 업그레이드한다.
  • API_SECRET을 강력한 고정 값으로 설정한다. 콜드 스타트마다 바뀌는 자동 생성 대체 값에 의존하지 않는다.
  • 필요하지 않다면 대시보드와 API를 공개 인터넷에 노출하지 않는다. 네트워크 또는 액세스 프록시 수준에서 접근을 제한한다.
  • API_SECRET이 미설정이거나 노출된 상태로 취약한 버전을 운영했다면, 연결된 Cloudflare 계정이 영향을 받았을 수 있다고 간주한다.
    • 해당 계정의 Workers에서 직접 배포하지 않은 스크립트가 있는지 검토한다.
    • cf-manager에 저장된 Cloudflare API 토큰을 교체한다.
  • 신뢰할 수 있는 스크립트 출처만 사용되도록 WORKER_DEPLOY_URL_ALLOWLIST 설정을 고려한다.

탐지

  • Cloudflare 계정에서 알 수 없는 시각이나 이름으로 생성 또는 수정된 Worker 스크립트를 찾는다. 계정 수준 감사 로그가 도움이 될 수 있다 (REVIEW_NOTES 참조).
  • cf-manager의 감사 테이블에서 1.1.2 이전 항목에는 소스 URL이 기록되지 않는다. 1.1.2부터는 deploy_worker 및 batch_deploy 항목에 url=... 또는 source=upload가 기록되므로, 예상하지 못한 URL 기반 배포가 있는지 검토한다.
  • cf-manager 호스트 또는 Worker에서 발생한 예상치 못한 아웃바운드 요청을 찾는다. 예로 배포 호출 시점 즈음에 내부 주소 범위나 낯선 호스트로 향한 요청이 있다.
  • Authorization 헤더 없이 도착했는데도 성공한 배포 요청을 찾는다. 이 패턴은 API_SECRET 미설정 사례를 가리킨다.

격리된 실습(로컬 Docker 랩)

이 취약점의 재현은 인터넷과 격리된 로컬 Docker 랩에서만 수행한다. 일회용 비프로덕션 Cloudflare 환경이나 Cloudflare API 목(mock)을 사용한다. 실제 계정, 실제 자격 증명, 소유하지 않은 네트워크에는 절대 적용하지 않는다.

취약한 버전과 패치된 버전을 나란히 사용하는 실습 제안:

  • 내부 전용 Docker 네트워크에서 1.1.1 버전과 1.1.2 버전을 실행하고, Cloudflare API 목과 직접 통제하는 로컬 웹 서버를 둔다.
  • workers.ts의 세 호출 지점이 각 버전에서 URL을 어떻게 처리하는지 관찰한다.
  • API_SECRET을 설정하지 않은 상태에서 이전 인증 미들웨어와 새 인증 미들웨어의 동작을 비교한다.
  • 패치된 버전이 non-HTTPS 스킴, 내부 주소 범위, 리다이렉트, 잘못된 콘텐츠 타입, 과도한 크기의 응답을 거부하는지 확인한다.

8. References

1. TL;DR

cf-manager is a dashboard that stores Cloudflare credentials and deploys Workers on a user’s behalf. In versions before 1.1.2, the Worker deployment routes accepted a URL, fetched it from the server with an unrestricted fetch(), and uploaded the response body to Cloudflare as a Worker script. The upload used the victim’s stored credentials.

Anyone who could call the deployment API could therefore make the server fetch arbitrary URLs. That includes attacker-controlled JavaScript, which then runs in the victim’s Cloudflare account. If API_SECRET was not configured, the authentication middleware let every request through, so no login was needed.

The vulnerability is fixed in 1.1.2.

2. Flaw classification

ItemValue
Primary CWECWE-94, Improper Control of Generation of Code (per NVD). NVD also lists CWE-918, Server-Side Request Forgery.
Product / affected versionscf-manager (npm), versions earlier than 1.1.2. Fixed in 1.1.2.
Affected endpointsPOST /api/:accountId/workers (multipart and JSON branches) and POST /api/batch-deploy
Attack vectorNetwork. The attacker sends a request to the deployment API.
ImpactThe server fetches attacker-chosen URLs. Attacker-supplied JavaScript is deployed and runs in the victim’s Cloudflare Workers account. CVSS 3.1 rates this as Scope Changed, with High confidentiality, integrity and availability impact.
PrerequisitesAccess to the deployment API, or no authentication at all when API_SECRET is not configured. The attacker also needs a URL that serves their script.
CVSS10.0 Critical, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

3. Root cause

The root cause is a trust-boundary failure in two parts.

1. Unvalidated server-side fetch. The advisory identifies three bare fetch(url) calls in worker/src/routes/workers.ts, at roughly lines 113, 126 and 527. They sit in the multipart branch, the JSON branch, and the batch-deploy handler. Each call takes a user-supplied URL and fetches it with nothing in between. The advisory lists what was missing:

  • protocol restriction
  • IP or host validation
  • redirect protection
  • Content-Type validation
  • response-size validation

2. Fetched content treated as trusted code. The response body was assigned to scriptContent. The code then sent it to the Cloudflare API in a PUT to the account’s workers/scripts/<name> endpoint, authenticated with the credentials the dashboard stores. The server makes the request and holds the credentials. The attacker chooses only the URL and, through it, the code.

Contributing factor: optional authentication. Before the fix, the auth middleware contained the equivalent of “if no API_SECRET is set, continue without checking”. A deployment that skipped setting API_SECRET exposed these routes to anyone who could reach them.

CWE-918 describes the first part and CWE-94 describes the second. Either one alone is weaker. The combination is what gives remote code execution in the victim’s account.

4. Exploit flow (conceptual)

This describes the concept of each step only. It contains no requests, URLs or payloads.

  1. Reach the API. The attacker calls the deployment route directly, or as an authorized API user. On deployments without API_SECRET, the middleware skipped authentication, so no credentials were needed.
  2. Supply a URL. The attacker submits a URL instead of a script body, through the multipart or JSON branch of the single-worker route or through batch-deploy. Nothing checks the scheme, destination host or address range.
  3. Server-side fetch. The cf-manager server requests that URL. The URL can point to a host the attacker controls, or to a location only the server can reach.
  4. Deploy as a Worker. The response body is uploaded as a Worker script to the Cloudflare account. The server authenticates with the stored credentials.
  5. Execution. Cloudflare runs the attacker’s script as a Worker in the victim’s account.
  1. reach deployment API — no auth if API_SECRET unset
  2. submit URL — no validation
  3. server-side fetch — stored creds not yet used
  4. upload body as Worker script — victim credentials
  5. attacker JS runs in victim Workers account
Conceptual flow — not an executable payload

5. Trigger conditions

  • cf-manager version is earlier than 1.1.2.
  • The attacker can reach POST /api/:accountId/workers or POST /api/batch-deploy.
  • One of these holds:
    • the attacker has legitimate or stolen access to the deployment API, or
    • API_SECRET is not configured, so the pre-fix middleware did not require authentication.
  • At least one Cloudflare account with stored credentials is configured in the dashboard. Without one, the deploy step has nothing to authenticate against.
  • The server can reach the attacker’s URL. The attacker needs to serve a response there for the code-execution outcome.

Setting API_SECRET closes the unauthenticated path but not the authenticated one. A user who legitimately holds the secret can still submit arbitrary URLs on a vulnerable version.

6. Patch analysis

Source: the fix commit 934aecb (“fix: SSRF vulnerability in URL-based Worker deployment (v1.1.2)”). I read the diffs for workers.ts, auth.ts and CHANGELOG.md. The diff for the new fetchScriptSafely.ts was not rendered on the commit page. I describe it only from the commit message and CHANGELOG (see REVIEW_NOTES).

Call sites

The patch replaces the three bare calls with one helper. Representative before and after (JSON branch):

+6−3ts
       const resp = await fetch(body.url);
       if (!resp.ok) return c.json({ error: { code: 'FETCH_ERROR', message: `Failed to fetch script: ${resp.status}` } }, 400);
       scriptContent = await resp.text();
       scriptUrl = body.url;
       try {
         scriptContent = await fetchScriptSafely(body.url, c.env);
       } catch (err: any) {
         return c.json({ error: { code: 'FETCH_ERROR', message: err.message } }, 400);
       }

The removed lines are where step 3 of the flow happens. The URL went straight into fetch() and the body went straight into scriptContent. The helper now sits between them, so a rejected URL, redirect, content type or size ends the request with an error and no deployment.

What the new helper enforces

The commit message and CHANGELOG list these checks:

  • Protocol allowlist: only https:.
  • Host and IP validation: rejects loopback, private, link-local and unique-local address ranges.
  • Redirect protection: redirect: manual, with the Location header validated at each hop.
  • Content-Type validation: only JavaScript or text types.
  • Response size limit: 5 MiB.
  • Optional URL source allowlist: configured through the environment variable WORKER_DEPLOY_URL_ALLOWLIST.

These checks close the SSRF side. The optional allowlist is the control that restricts the code source, which is the CWE-94 side. If it is not set, a public https URL serving JavaScript is still accepted. That follows from the described design, but I did not read the implementation to confirm it.

Authentication change

+3−2ts
   const secret = c.env.API_SECRET;
   if (!secret) return next();
   let secret = c.env.API_SECRET;
   // If API_SECRET is not configured, auto-generate a cryptographically random secret
   if (!secret) { ... secret = _autoGeneratedSecret; }

The deleted return next() is what made an unset API_SECRET mean “no authentication”. The patched code generates a random secret, logs a warning, and then requires it like any other secret. Per the code comments, the generated secret lasts until the next Worker cold start.

Audit logging

The deploy and batch-deploy audit entries now record url=<source> or source=upload in the detail field. This does not prevent anything, but it helps with investigation after the fact.

7. Detection & mitigation

Immediate actions

  • Upgrade cf-manager to 1.1.2 or later.
  • Set API_SECRET to a strong, fixed value. Do not rely on the auto-generated fallback, which changes on cold start.
  • Do not expose the dashboard or its API to the public internet if it is not needed. Restrict access at the network or access-proxy level.
  • If you ran a vulnerable version with API_SECRET unset or exposed, treat the connected Cloudflare accounts as potentially affected:
    • review the Workers in those accounts for scripts you did not deploy
    • rotate the Cloudflare API tokens stored in cf-manager
  • Consider setting WORKER_DEPLOY_URL_ALLOWLIST so that only trusted script sources can be used.

Detection

  • In the Cloudflare account, look for Worker scripts that were created or updated at times or under names you do not recognize. Account-level audit logs may help here (see REVIEW_NOTES).
  • In cf-manager’s audit table, entries from before 1.1.2 do not record the source URL. From 1.1.2 on, deploy_worker and batch_deploy entries carry url=... or source=upload, so review any URL-sourced deployment you do not expect.
  • Look for unexpected outbound requests from the cf-manager host or Worker. Examples are requests to internal address ranges or to unfamiliar hosts around the time of a deploy call.
  • Look for deploy requests that arrived without an Authorization header and still succeeded. This pattern points to the unset API_SECRET case.

Isolated practice (local Docker lab)

Reproduce this only in a local Docker lab that is isolated from the internet. Use a throwaway, non-production Cloudflare setup or a mock of the Cloudflare API. Never point it at real accounts, real credentials, or networks you do not own.

Suggested exercises, using the vulnerable and patched versions side by side:

  • Run version 1.1.1 and version 1.1.2 on an internal-only Docker network, with a mock Cloudflare API and a local web server you control.
  • Observe how the three call sites in workers.ts handle a URL in each version.
  • With API_SECRET unset, compare the behavior of the old and new auth middleware.
  • Check that the patched version rejects non-HTTPS schemes, internal address ranges, redirects, wrong content types and oversized responses.

8. References