실습> Client Validation (JavaScript)
첫 번째 해결 방법 : burp를 이용해서 검증을 우회한다.
두 번째 해결 방법 : 개발자 도구를 이용해서 검증을 우회한다.
-- post2.html --
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title> ::: post2.html ::: </title>
</head>
<body>
<script language=Javascript>
function loginCheck() {
if(document.login.userid.value == '') {
alert('사용자를 입력하세요!');
document.login.userid.focus();
return false;
}
if(document.login.userpw.value == '') {
alert('비밀번호를 입력하세요!');
document.login.userpw.focus();
return false;
}
return true;
}
</script>
<form name=login method=post action=post.php onSubmit="return loginCheck()">
<table align=center bgcolor=#000000 border=0
cellpadding=4 cellspacing=1 width=300 >
<tr bgcolor=#ffffff>
<td align=center width=100> 이름 </td>
<td width=240> <input type=text name=userid> </td>
</tr>
<tr bgcolor=#ffffff>
<td align=center width=60> 비밀번호 </td>
<td width=240> <input type=password name=userpw> </td>
</tr>
<tr bgcolor=#ffffff>
<td align=center colspan=2>
<input type=submit value='저장'> </td>
</tr>
</table>
</form>
</body>
</html>
-- post2.html --
실습> Server Validation (PHP + Javascript)
-- post.php --
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title> ::: post.php ::: </title>
</head>
<body>
<?
/*
* POST 방식으로 넘어온 변수를 인식하는 방법
* $_POST['변수명']
*/
/****** Server Validation Check *****/
/*
* isset() 함수는 변수가 존재하면 true를 리턴한다.
* isset() 함수는 변수가 존재하지 않으면 false를 리턴한다.
*/
// userid, userpw 변수가 존재하면
//if(isset($_POST['userid']) and isset($_POST['userpw']))
if(isset($_POST['userid']) && isset($_POST['userpw']))
{
// userid, userpw 변수의 값이 하나라도 없다면
// 에러메세지를 출력하고 뒤로 돌려보낸다.
if($_POST['userid'] == '' || $_POST['userpw'] == '')
{
echo "<script>
alert('아이디와 비밀번호를 입력해야 합니다.');
// history.go(-1);
history.back();
</script>
";
exit; // 스크립트 종료
}
// 값이 있다면 출력한다.
print_r($_POST);
} else { // userid, userpw 변수가 하나라도 존재하지 않으면
echo "<script>
alert('아이디와 비밀번호를 작성해야 합니다.');
// history.go(-1);
history.back();
</script>
";
exit;
}
/****** Server Validation Check *****/
// 여기 부분은 검증이 완료된 이후의 실행코드들이 온다.
?>
</body>
</html>
-- post.php --
'Linux > 모의해킹' 카테고리의 다른 글
| SwitchyOmega 에서 Auto Switch 설정하기 (0) | 2022.01.20 |
|---|---|
| Brute Force 로그인 공격 (0) | 2022.01.20 |
| Client Validation 실습 (0) | 2022.01.20 |
| GET / POST 방식의 전송 proxy 분석하기 (0) | 2022.01.19 |
| 웹 데이터 조작하기 (0) | 2022.01.19 |