실습> Client Validation
• 데이터 검증(Validation)
- 서버에 전달되는 입력 값의 검증을 위해 Client 또는 Server에서 실행되는 데이터 확인 과정
- 종류
Client Side Validation
Server Side Validation
- 두 가지 방식을 적절히 혼용하는 것이 좋음
• Client Side Validation
- 클라이언트의 입력을 클라이언트 측에서 검증 후 서버에 전달 함
- Browser에서 제공되는 기능, HTML, Javascript 등을 이용하여 검증 후 검증된 데이터를 서버로 전송 함
- 장점 → 서버의 부하가 없음
- 단점 → 검증 결과가 쉽게 조작될 수 있음(Bypassing Client Side Validation)
• Server Side Validation
- 클라이언트의 입력을 서버 측에서 검증 후 받아들임
- SSS(ASP, PHP, JSP ...)로 검증 후 또는 변환 후 검증된 데이터를 서버로 전송 함
- 장점 → 검증된 데이터의 신뢰도가 높음
- 단점 → 서버의 부하가 높아 짐, 필터링 우회가 가능한 경우 조작된 데이터를 받아들일 수 있음
Client Validation은 proxy에서 얼마든지 수정할 수 있다.
HTML의 maxlength=3 을 설정하고 이걸 우회해보자.
GET 방식
1. 소스코드 수정
get.html을 수정한다.
[root@www ~]# cd /var/www/html
[root@www html]# vi get.html
<td align=center width=100> 이름 </td>
<td width=240> <input type=text name=userid maxlength=5> </td>
</tr>
<tr bgcolor=#ffffff>
<td align=center width=60> 비밀번호 </td>
<td width=240> <input type=password name=userpw maxlength=3> </td>
</tr>
<tr bgcolor=#ffffff>
<td align=center colspan=2>
<input type=submit value='저장'> </td>
</tr>
</table>
</form>
</body>
</html>
2. get.html 새로고침
http://192.168.108.101/get.html
3. get.html 을 이용해서 로그인 시도
이름 : admin
비밀번호 : 111111
http://192.168.108.101/get.php?userid=admin&userpw=111111
Array ( [userid] => admin [userpw] => 111111 )
POST 방식
1. 소스코드 수정
post.html을 수정한다.
[root@www html]# vi post.html
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title> ::: post.html ::: </title>
</head>
<body>
<form method=post action=post.php>
<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 maxlength=3> </td>
</tr>
<tr bgcolor=#ffffff>
<td align=center width=60> 비밀번호 </td>
<td width=240> <input type=password name=userpw maxlength=3> </td>
</tr>
<tr bgcolor=#ffffff>
<td align=center colspan=2>
<input type=submit value='저장'> </td>
</tr>
</table>
</form>
</body>
</html>
2. post.html 새로고침
http://192.168.108.101/post.html
3. post.html 을 이용해서 로그인 시도
이름 : admin
비밀번호 : 111111
해결 방법은 3가지가 있다.
http://192.168.108.101/post.php
Array ( [userid] => admin [userpw] => 111111 )
첫 번째 해결 방법 : burp를 이용한다.
두 번째 해결 방법 : 개발자 도구를 이용한다.
세 번째 해결 방법 : 자신의 PC에서 post.html로 저장하고 아래처럼 수정한 후 브라우저로 연다.
- <form method=post action=http://192.168.108.101/post.php>
'Linux > 모의해킹' 카테고리의 다른 글
| Brute Force 로그인 공격 (0) | 2022.01.20 |
|---|---|
| Client Validation (JavaScript & PHP) (0) | 2022.01.20 |
| GET / POST 방식의 전송 proxy 분석하기 (0) | 2022.01.19 |
| 웹 데이터 조작하기 (0) | 2022.01.19 |
| burp (proxy) 툴 사용하기 (0) | 2022.01.19 |