Tyojong

[The Ethernaut] Vault 본문

web3/The Ethernaut

[The Ethernaut] Vault

Tyojong 2026. 1. 28. 17:40

문제 설명


코드 분석

문제 컨트랙트 배포 시 설정된 패스워드와 일치하는 패스워드를 unlock함수 인자로 넣으면 금고의 잠금이 해제된다.


익스플로잇

password 변수가 private로 선언되어 있지만 private은 단순히 다른 컨트랙트에서 접근을 막을 뿐, 외부에서 직접 스토리지를 조회하는 것은 막지 못한다.

 

cast storage 명령어를 사용해 storage 슬롯을 읽는다. (슬롯0: locked, 슬롯1: password)

 

알아낸 패스워드를 unlock함수의 인자로 넣고 실행시키면

 

문제를 해결할 수 있다.

 

'web3 > The Ethernaut' 카테고리의 다른 글

[The Ethernaut] Force  (0) 2026.01.28
[The Ethernaut] Delegation  (0) 2026.01.27
[The Ethernaut] Token  (0) 2026.01.26
[The Ethernaut] Coin Flip  (0) 2026.01.26
[The Ethernaut] Telephone  (0) 2026.01.07