🇰🇷 한글 설명
Vyper 0.4.2rc1 이하에서 slice() 함수가 출력 길이가 0일 때 side effects를 의도적으로 생략하는 취약점입니다. msg.data나 주소의 code에 대해 slice 호출 시 start 인자의 부작용이 무시될 수 있어 보안 검사를 우회할 수 있습니다.
💡 쉬운 설명
Vyper 프로그래밍 언어의 특정 기능이 특정 상황에서 중요한 코드 실행을 건너뛸 수 있습니다. 이를 악용하면 보안 관련 작업이 제대로 실행되지 않을 수 있습니다.
🇺🇸 원문 (English)
Vyper is the Pythonic Programming Language for the Ethereum Virtual Machine. In versions up to and including 0.4.2rc1, the `slice()` builtin can elide side effects when the output length is 0, and the source bytestring is a builtin (`msg.data` or `<address>.code`). The reason is that for these source locations, the check that `length >= 1` is skipped. The result is that a 0-length bytestring constructed with slice can be passed to `make_byte_array_copier`, which elides evaluation of its source argument when the max length is 0. The impact is that side effects in the `start` argument may be elided when the `length` argument is 0, e.g. `slice(msg.data, self.do_side_effect(), 0)`. The fix in pull request 4645 disallows any invocation of `slice()` with length 0, including for the ad hoc locations discussed in this advisory. The fix is expected to be part of version 0.4.2.
📍 영향받는 시스템
Vyper 버전 0.4.2rc1 이하
⚔️ 공격 벡터
slice() 함수를 길이 0으로 호출하면서 start 인자에 side effects가 있는 코드를 작성하여 의도된 검사나 상태 변경을 건너뜀
🛡️ 대응 방법
Vyper를 0.4.2 이상으로 업그레이드
🔧 검증 코드
반환된 버전이 0.4.2 이상이면 안전, 0.4.2rc1 이하이거나 설치되지 않으면 취약한 상태
python3 -c "import vyper; print(vyper.__version__)" 2>/dev/null || echo 'vyper not installed'