🇰🇷 한글 설명
Python 3.12.0 이상에서 asyncio._SelectorSocketTransport.writelines() 메서드가 write buffer의 high-water mark에 도달했을 때 protocol에 drain 신호를 보내지 않는 버그입니다. 이로 인해 write buffer가 주기적으로 비워지지 않아 메모리 고갈로 이어질 수 있습니다.
💡 쉬운 설명
Python에서 데이터를 보낼 때 메모리 버퍼가 가득 차면 비우도록 신호하는 기능이 작동하지 않습니다. 이로 인해 컴퓨터의 메모리가 계속 증가하여 시스템이 다운될 수 있습니다.
🇺🇸 원문 (English)
Starting in Python 3.12.0, the asyncio._SelectorSocketTransport.writelines()
method would not "pause" writing and signal to the Protocol to drain
the buffer to the wire once the write buffer reached the "high-water
mark". Because of this, Protocols would not periodically drain the write
buffer potentially leading to memory exhaustion.
This
vulnerability likely impacts a small number of users, you must be using
Python 3.12.0 or later, on macOS or Linux, using the asyncio module
with protocols, and using .writelines() method which had new
zero-copy-on-write behavior in Python 3.12.0 and later. If not all of
these factors are true then your usage of Python is unaffected.
📍 영향받는 시스템
Python 3.12.0 이상 (Linux, macOS), asyncio 모듈 사용, .writelines() 메서드 호출 시스템
⚔️ 공격 벡터
.writelines() 메서드를 통한 지속적인 데이터 전송으로 write buffer 누적
🛡️ 대응 방법
Python을 3.12.1 이상으로 업그레이드하거나 asyncio 다른 write 메서드 사용
🔧 검증 코드
3.12.0이 출력되면 취약 상태, 3.12.1 이상이면 패치된 상태입니다.
python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')" 2>/dev/null | grep -E '3\.12\.0'