Predic's Study BLOG
· WriteUp
이번 codegate 2025 general 부분으로 나가서 본선진출권을 어찌어찌 따냈다...다만 팀원 분들의 캐리로 순위권에 든거라.. 아직 실력이 부족하다는걸 많이 느낀 대회였다.웹 문제가 개인적으로 빡셌다 생각하긴 하는데 뭐 여튼 어김없이 롸업을 써보겠다.1. Masquerade (41 solved)최다 솔버가 나온 문제이다.솔직히 다른 씨텦에서 나오면 솔버가 이렇게 많지는 않을거 같은데 코게여서 그런거 같다;;먼저 flag는 report기능의 어드민 쿠키에 있으므로 xss문제이다.로그인을 하고 들어가면 role을 변경할 수 있는 창과 post를 올릴 수 있는 창이 나온다.코드를 확인하면 postGaurd에 의해 hasPerm이 true여야 write를 할 수 있다. router.post('/wri..
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;import "openzeppelin-contracts-08/token/ERC20/IERC20.sol";import "openzeppelin-contracts-08/token/ERC20/ERC20.sol";import "openzeppelin-contracts-08/access/Ownable.sol";contract DexTwo is Ownable { address public token1; address public token2; constructor() {} function setTokens(address _token1, address _token2) public onlyOwner {..
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;import "openzeppelin-contracts-08/token/ERC20/IERC20.sol";import "openzeppelin-contracts-08/token/ERC20/ERC20.sol";import "openzeppelin-contracts-08/access/Ownable.sol";contract Dex is Ownable { address public token1; address public token2; constructor() {} function setTokens(address _token1, address _token2) public onlyOwner { ..
· Information
Math.random 함수는 nodejs 같은 프레임워크에서 사용되며 주로 난수 발생을 위한 기능으로 사용됩니다.그러나 대부분이 알고있듯이 Math.random함수는 PRNG를 통해 난수를 생성하는데 이는 암호학적으로 다음 값 예측이 가능합니다. 그래서 원래는 Math.random값을 전부 알 경우에 특정 도구를 통해서 다음값을 예측이 가능한데...이번 LA CTF 문제를 복기하다가 Math.random값이 변형되거나 일부만 알때도 다음값이 예측 가능하다는 점을 새로 알게되서 글로 정리해보려 합니다. Math.random 전체 값을 알 경우Math.random의 전체 값은 대충0.9311600617849973 이런 소수값으로 나옵니다.해당 경우엔 아래 유명한 v8-randomness-predictor를 ..
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;interface Buyer { function price() external view returns (uint256);}contract Shop { uint256 public price = 100; bool public isSold; function buy() public { Buyer _buyer = Buyer(msg.sender); if (_buyer.price() >= price && !isSold) { isSold = true; price = _buyer.price(); } }} 얘도 문제를 애매하..
If you can deny the owner from withdrawing funds when they call withdraw() (whilst the contract still has funds, and the transaction is of 1M gas or less) you will win this level.// SPDX-License-Identifier: MITpragma solidity ^0.8.0;contract Denial { address public partner; // withdrawal partner - pay the gas, split the withdraw address public constant owner = address(0xA9E); uint256 ti..
· Information
Fallback과 Receive함수는 둘 다 이더를 전송 받을 때 사용되는 함수이다.그러나 두 함수에 몇가지 차이점도 있고 헷갈리는 부분이 있어 정리할려 한다. 공통점- 상대방이 이더를 전송해서 내 컨트랙트에서 이더를 받을 때 실행된다. 차이점순수하게 이더만 전송할때는 Receive()이더와 데이터를 포함하여 전송 또는 잘못된 함수를 호출할때 Fallback()함수가 호출된다.예를 들어,contractAddress.call{value: 1 ether}();는 Receive함수를contractAddress.call{value: 1 ether}("someData");는 Fallback 함수를 호출한다. 다만, 순수하게 이더만 전송할 때, Receive함수가 없고 Fallback 함수만 있으면 Fallback..
// SPDX-License-Identifier: MITpragma solidity ^0.5.0;import "../helpers/Ownable-05.sol";contract AlienCodex is Ownable { bool public contact; bytes32[] public codex; modifier contacted() { assert(contact); _; } function makeContact() public { contact = true; } function record(bytes32 _content) public contacted { codex.push(_content); } func..
To solve this level, you only need to provide the Ethernaut with a Solver, a contract that responds to whatIsTheMeaningOfLife() with the right 32 byte number.Easy right? Well... there's a catch.The solver's code needs to be really tiny. Really reaaaaaallly tiny. Like freakin' really really itty-bitty tiny: 10 bytes at most.Hint: Perhaps its time to leave the comfort of the Solidity compiler mome..
프레딕
소소한 해킹 블로그