[DreamHack] [Web] Trust the Client Filter

image.png

image.png

김보안씨의 눈물겨운 날먹 스토리…

분석 시작하겠다.

query = f"SELECT id FROM users WHERE id = '{userId}' AND password = '{userPw}'"

파일을 열면 query.txt 파일이 있는데, 해당 파일의 내용은 이게 전부다.

소스코드도 없고, 그냥 웹만 접속이 가능하다.

따라서, 웹에 직접 접속해서 여러가지 정보들을 모아보겠다.

image.png

다짜고짜 로그인부터 요구한다.

html 소스코드를 한번 보겠다.


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kimboan Web Site</title>
	<script src="<https://cdn.jsdelivr.net/npm/node-forge@1.3.1/dist/forge.min.js>"></script>
	<script src="utils.js" defer></script>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
        }

        .container {
            position: relative;
            background-color: white;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            text-align: center;
        }

        h2 {
            margin-bottom: 20px;
            font-size: 24px;
            color: #333;
        }

        input[type="text"], input[type="password"] {
            width: 80%;
            padding: 10px;
            margin-bottom: 20px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
        }

        button {
            padding: 10px 20px;
            font-size: 16px;
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        button:hover {
            background-color: #218838;
        }

    </style>
</head>
<body>

    <div class="container">

        <h2>Login</h2>
        <form id ="Login" onsubmit="encryptAndSend(event)">
            <input type="text" id="idInput" name="id" placeholder="ID">
			<input type="password" id="pwInput" name="password" placeholder="Password">
            <br>
            <button type="submit">Send</button>
        </form>
		<pre id="result"></pre>
    </div>

</body>
</html>

외부 라이브러리 두개를 호출한다.

뭔가 무난한 로그인 페이지 처럼 보이지만, 실제로는 submit시 그냥 서버로 POST를 하는게 아니다.

encryptAndSend(event)라는 JS 함수가 실행되며, node-forge가 로드되어 있는 것을 보아,

아이디와 비밀번호를 전송하기 전에 암호화하는 구조로 추측된다.