Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
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
Archives
Today
Total
관리 메뉴

의미없는 블로그

[ASP.NET] 닷넷 전처리 IHttpModule (Reflected XSS 필터링) 본문

# 나/source Code

[ASP.NET] 닷넷 전처리 IHttpModule (Reflected XSS 필터링)

SaltLee 2024. 4. 22. 12:14

닷넷에 HTTP Module 이라는 개념 있다고 함

 

요걸로 HTTP 요청 시작하거나 종료할때 이벤트를 처리할 수 있다고 함

그래서 이걸로 HTTP 요청에 대한 전처리 구현하나 봄

 

*.cs 파일에 IHttpModule 인터페이스 받아다가 쓰는 형태라고 함

*.cs

Init
모듈이 초기화될 때 실행할 코드 
Dispose
모듈이 해제될 때 실행할 코드
BeginRequest 
요청이 시작될 때 수행할 작업
EndRequest
요청이 종료될 때 수행할 작업

 

그래서 IHttpModule 모듈 있는 곳에서

url 관련해서 처리 하는 부분 있나 보면 될 것 같다

*.cs HttpContext.Current.Request
HttpContext.Current.Request.Url.AbsoluteUri
전체 URL 을 반환
http://www.test.com/sample/page?param=1
HttpContext.Current.Request.RawUrl
URI 를 반환
/sample/page?param=1
HttpContext.Current.Request.Path
URI 중에 Path 만 반환
/sample/page

 

Module2.cs 에서

InitBeginRequestOnBeginRequest 

OnBeginRequestDoPageValueRequest

DoPageValueRequest 에서 ", %22, %u0022 에 대해 제거리다이렉트 하고 있다

" 넣었을 때

%22 넣었을 때

%u0022 넣었을 때

<script>alert(1)</script> 넣었을 때 (취약)

Comments