🔍 CVE-2025-12781

0.0
CVSS Score
UNKNOWN
2026-01-21
2026-01-22 21:15
✅ 완료

🇰🇷 한글 설명

Python의 base64 모듈에서 b64decode(), standard_b64decode(), urlsafe_b64decode() 함수가 '+'와 '/' 문자를 항상接受하는 취약점

💡 쉬운 설명

Python의 base64 모듈에서 '+'와 '/' 문자가 항상接受되어 데이터 무결성 문제가 발생할 수 있습니다. 하지만 이는 altchars 파라미터를 사용하지 않는 경우에는 영향을 미치지 않습니다.

🇺🇸 원문 (English)

When passing data to the b64decode(), standard_b64decode(), and urlsafe_b64decode() functions in the "base64" module the characters "+/" will always be accepted, regardless of the value of "altchars" parameter, typically used to establish an "alternative base64 alphabet" such as the URL safe alphabet. This behavior matches what is recommended in earlier base64 RFCs, but newer RFCs now recommend either dropping characters outside the specified base64 alphabet or raising an error. The old behavior has the possibility of causing data integrity issues. This behavior can only be insecure if your application uses an alternate base64 alphabet (without "+/"). If your application does not use the "altchars" parameter or the urlsafe_b64decode() function, then your application does not use an alternative base64 alphabet. The attached patches DOES NOT make the base64-decode behavior raise an error, as this would be a change in behavior and break existing programs. Instead, the patch deprecates the behavior which will be replaced with the newly recommended behavior in a future version of Python. Users are recommended to mitigate by verifying user-controlled inputs match the base64 alphabet they are expecting or verify that their application would not be affected if the b64decode() functions accepted "+" or "/" outside of altchars.

📍 영향받는 시스템

Python 3.x

⚔️ 공격 벡터

사용자 입력 데이터를 검증하지 않고 base64 디코딩 함수에 전달하는 경우

🛡️ 대응 방법

사용자 입력 데이터를 검증하거나 altchars 파라미터를 사용하여 대체 문자를 지정하여 취약점을 완화할 수 있습니다.

🔧 검증 코드

로컬 시스템에서 Python을 실행하여 코드를 실행합니다. 코드는 altchars 파라미터를 사용하지 않는 경우에 취약한지 여부를 확인합니다.

Shell / Script
import base64
import sys

# altchars 파라미터를 사용하지 않는 경우
try:
    base64.b64decode('abc+/', altchars=None)
    print("{\"result\": \"취약\", \"reason\": \"altchars 파라미터를 사용하지 않음\"}")
except Exception as e:
    print("{\"result\": \"양호\", \"reason\": \"altchars 파라미터를 사용함\"}")

💻 영향받는 소프트웨어

Python