https://dreamhack.io/wargame/challenges/336
I have accounts. but, it's blocked.
can you login bypass filtering?
get source에 접속해 소스코드를 확인해봅니다.$id = mysqli_real_escape_string($conn, trim($_POST['id']));
$ps = mysqli_real_escape_string($conn, trim($_POST['ps']));trim: 입력값에 공백이 있다면, 제거합니다.mysqli_real_escape_string: SQL 인젝션 방지용 이스케이핑입니다. (특수 문자 (예: ', ", \, NULL) 앞에 백슬래시(\)를 붙여 이스케이프 처리합니다.) 하지만, 논리적 취약점이나 다른 DB 설정에 따라 우회 가능성이 있는 함수입니다. if(isset($row['id'])){
if($id=='guest' || $id=='blueh4g'){
echo "your account is blocked";
}else{
echo "login ok"."<br />";
echo "FLAG : ".$FLAG;
}
}else{
echo "wrong..";
}guest 나 blueh4g 면 차단됩니다. you have blocked accounts.
guest / guest
blueh4g / blueh4g1234ps차단 id의 비밀번호를 확인할 수 있습니다.mysqli_real_escape_string을 통해 거의 불가능 한 상태이고, 다른 접근이 필요함을 알 수 있었습니다.

mysqli_real_escape_string 이스케이핑에 대해 배웠습니다. 평범한 SQL 인젝션 공격을 막아줄 수 있기에 편리합니다. 하지만, 이 문제에서는 이용하지 않았지만, 다른 우회 방법도 존재하다고 하기에 조심해서 사용해야 함을 배웠습니다.trim() (removing whitespace) and mysqli_real_escape_string() (escaping special characters) to prevent basic SQL injection.Guest (capital "G") instead of guest, the PHP block does not trigger, but MySQL still treats it as matching the stored ID, allowing login.