일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 무선랜카드
- ASP
- form
- euc-kr
- 따라다니는 배너
- 크로스 컴파일
- synology
- ajax
- Getrows
- XMLHTTP
- submit
- println
- RTL88x2BU
- readonly
- AC1300
- lsusb
- PHP GCM
- SQL Injection
- 커널
- replace
- include
- DS718+
- Injection
- 시놀로지
- disabled
- utf-8
- jquery 레이어
- FileSystemObject
- javascript
- jQuery
- Today
- Total
아는 것이 좋은 것이다.
[ASP] ASP SQL Injection 방어 소스 본문
SQL Injection 방어 함수
ReForm 이라는 함수를 생성
<%
Function ReForm (sString , nMaxLen , isNum )
'// Request 로 들어온 변수를 처리한다.
'// sString : 넘겨받는 변수 (string)
'// nMaxLen : 최대 길이 (number) (최대길이를 검사하지 않은경우 0)
'// isNum : 숫자인지 아닌지 (1 : only number , 0 : 숫자판별 안함)
Dim temp
Dim nErr
temp = Trim (sString ) & ""
if isNum = 1 then '숫자판별
if isNumeric (temp) = False then
response.write ( temp & " is Not Number " )
response.End
End if
end if
if nMaxLen > 0 then '최대길이 판별
if len(temp) > nMaxLen then
response.write ( temp & " is over Maxlength " & nMaxLen )
response.end
end if
end if
'// injection 관련 키워드 제거(항목 추가 가능)
temp = Replace ( temp , "'" , "" )
temp = Replace ( temp , "--" , "" )
temp = Replace ( temp , "--, #" , " " )
temp = Replace ( temp , "/* */" , " " )
temp = Replace ( temp , "' or 1=1--" , " " )
temp = Replace ( temp , "union" , " " )
temp = Replace ( temp , "select" , " " )
temp = Replace ( temp , "delete" , " " )
temp = Replace ( temp , "insert" , " " )
temp = Replace ( temp , "update" , " " )
temp = Replace ( temp , "drop" , " " )
temp = Replace ( temp , "on error resume" , " " )
temp = Replace ( temp , "execute" , " " )
temp = Replace ( temp , "windows" , " " )
temp = Replace ( temp , "boot" , " " )
temp = Replace ( temp , "-1 or" , " " )
temp = Replace ( temp , "-1' or" , " " )
temp = Replace ( temp , "../" , " " )
temp = Replace ( temp , "unexisting" , " " )
temp = Replace ( temp , "win.ini" , " " )
ReForm = temp
End Function
%>
SQL Injection 방어 함수 적용
(ReForm 함수 사용)
<%
param1 = ReForm(request.Form("param1"),0,0)
%>
'ASP' 카테고리의 다른 글
[ASP] 기본 필수 함수 (0) | 2014.04.24 |
---|---|
[ASP] 비교문 함수 (0) | 2014.04.24 |
[ASP] get방식, post방식 예제(자바스크립트로 페이지 이동) (0) | 2014.04.24 |
[ASP] (XMLHTTP) 요청, 불러오기 (0) | 2014.04.24 |
[ASP] HTML 태그 제거 (0) | 2014.04.24 |