'2025/05/21'에 해당되는 글 1건

  1. 2025.05.21 modsecurity request_cookies 차단되는 경우
728x90
반응형

아래와 같이 request_cookies를 SQL INJECTION으로 차단하는 경우

 

/var/log/httpd/ssl_error_log:[Tue May 20 00:05:24 2025] [error] [client 164.55.242.106] ModSecurity: Access denied with code 403 (phase 2). Pattern match "(?i:(?:\\A|[^\\d])0x[a-f\\d]{3,}[a-f\\d]*)+" at REQUEST_COOKIES:PHPSESSID. [file "/etc/httpd/modsecurity.d/activated_rules/modsecurity_crs_41_sql_injection_attacks.conf"] [line "55"] [id "981260"] [rev "2"] [msg "SQL Hex Encoding Identified"] [data "Matched Data: J0Xb29 found within REQUEST_COOKIES:PHPSESSID: fUF8YhjYwrF-tvI-11zCMJ0Xb29"] [severity "CRITICAL"] [ver "OWASP_CRS/2.2.6"] [maturity "8"] [accuracy "8"] [tag "OWASP_CRS/WEB_ATTACK/SQL_INJECTION"] [tag "WASCTC/WASC-19"] [tag "OWASP_TOP_10/A1"] [tag "OWASP_AppSensor/CIE1"] [tag "PCI/6.5.2"] [hostname "www.d.com"] [uri "/document/korean/css/font.css"] [unique_id "aCtItNMglaEAAGHcczAAAAAN"]

 

해당 접속건은 정상적인 것으로 판단되며 제외 설정 하면 된다.

 

 


# Rule 제거, ID사이 공백 구분 
#modsecurity_crs_20_protocol_violations.conf 
SecRuleRemoveById 950xxx 950xxx 958xxx              <--- 탐지에서 제외되는 룰
.....
#modsecurity_crs_41_sql_injection_attacks.conf 
# 제외시킬 룰이 여러개일 경우 " - "로 여러개를 지정
SecRuleRemoveById 950xxx 959xxx "981242 - 981248" 981257

# 룰을 제거하지 않고 특정 요청에 대해서만 제외
#SecRuleUpdateTargetById RuleID !REQUEST_COOKIES,!REQUEST_COOKIES_NAMES 
SecRuleUpdateTargetById 950xxx !ARGS:title,!REQUEST_COOKIES 
SecRuleUpdateTargetById 950xxx !ARGS:url
SecRuleUpdateTargetById 973xxx!ARGS:title,!ARGS:cId,!REQUEST_COOKIES
SecRuleUpdateTargetById 950xxx !REQUEST_COOKIES,!REQUEST_COOKIES_NAMES,!ARGS_NAMES:object_type
SecRuleUpdateTargetById 981xxx !REQUEST_COOKIES,!REQUEST_COOKIES_NAMES
 

 

참고: https://blog.naver.com/kf80s/220763330824

 

728x90
SMALL
Posted by gromet
이전버튼 1 이전버튼

블로그 이미지
나는 운이 좋은 사람이다 나는 나날이 점점 더 좋아진다 내가 하는 선택과 행동은 반드시 성공으로 이어진다 내게는 인내력과 지속력이 있다 네게는 좋은것들만 모여든다
gromet

공지사항

Yesterday
Today
Total
반응형

달력

 « |  » 2025.5
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

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

160x600