mod_security 적용하다 보니 문제점이 있어서 도움을 받고싶습니다.

환골탈태의 이미지

mod_security 적용하다 보니 문제점이 있어서 도움을 받고싶습니다.

아마도 한글문제인거 같구요

* 문제 발생 내용
mod_security 환경설정 파일과 상관없이 403 error code를 출력하는 경우입니다.
- 웹에서 다운로드시 파일명이 한글,일본어등 2byte일 경우
- 업로드 및 phpMyAdmin 사용, 게시판 글 수정등 파라미터 값 중에 한글등 2byte가 존재할 경우

* 서버설정 내용
- Apache 설정
문자셋과 관련하여 특별한 설정이 없습니다.

- mod_url 설정
서버의 한글처리 문제인가 싶어 cvs.oops.org에서 다운받은 mod_url.c를 DSO로 설치 & 설정 하였습니다.
그런데 CheckURL을 On으로 하나 Off하나 mod_security의 한글문제는 별다른 차이가 없었습니다.
------------------------------------------------------------------------

CheckURL On
ServerEncoding EUC-KR
ClientEncoding UTF-8

------------------------------------------------------------------------

- mod_security 설정
------------------------------------------------------------------------
SecFilterScanPOST On
SecFilterCheckURLEncoding On
SecFilterCheckUnicodeEncoding Off

기타 설정들은 기본값이며, 아래의 URL을 참조하여 설정했습니다.
http://www.modsecurity.org/projects/rules/index.html
------------------------------------------------------------------------

- 에러로그 일부입니다.
------------------------------------------------------------------------
접속 URL : http://domain.co.kr/music/01-음악.mp3

[16/Jun/2006:11:59:24 +0900] [domain.co.kr/sid#822e23c][rid#8219c2c][/music/01-\xc0\xcf\xbe\xee.mp3][1]
Access denied with code 403. Error normalising REQUEST_URI: Invalid character detected [192]

Request: domain.co.kr 211.227.77.xxx - - [14/Jun/2006:16:28:37 +0900] "GET /music/01-\xdd\xfc\xdf\xe4\xaa\xce\xcd\xf6.mp3 HTTP/1.1" 403 2423 "-" "contype" - "-"

----------------------------------------

GET /music/01-음악.mp3 HTTP/1.1
Accept: */*
Host: domain.co.kr
User-Agent: contype
mod_security-message: Access denied with code 403. Error normalising REQUEST_URI: Invalid character detected [221]

Request: domain.co.kr 211.202.xx.xxx - userid [14/Jun/2006:15:34:48 +0900] "POST /phpMyAdmin/tbl_replace.php H
TTP/1.0" 403 2411 "http://domain.co.kr/phpMyAdmin/tbl_change.php?db=userid&table=test&goto=tbl_properties_stru
cture.php&back=tbl_properties_structure.php" "Mozilla/5.0 (X11; U; Linux i686; ko-KR; rv:1.7.13) Gecko/20060420 Firefox/1.0.8 Asianux/1.0.8-1.4.1hs" - "-"

mod_security-message: Access denied with code 403. Error parsing multipart parameters: Error normalising parameter value: Invalid character detected [187]
mod_security-action: 403
------------------------------------------------------------------------

즉 한글만 들어가면 mod_security 설정과 관계없이 Invalid character detected 이렇게 에러가 뜨면서
deny이 된다는 겁니다. 설정에서 pass나 allow 할 수 없으니 더욱 난감하네요

http://www.honeynet.org/scans/scan31/sub/tina_stelmack/tina_stelmack.pdf
위의 문서를 보니 The valid character set is : A-Z a-z 0-9 _ - . 이렇게 되어있었습니다.

그냥 mod_security.c 소스에서 해당부분 함수를 찾아서 주석처리하면 될라나요? ^^

암암..땐놈들 때문에 언능 적용해야 되는데 며칠째 고민만 하고 있네요.

환골탈태의 이미지

#######################################
#SecFilterForceByteRange 32 126
SecFilterForceByteRange 0 255
#######################################

# Byte Range check를 위해 32byte에서 126만 허용했었는데 이게 문제였나 봅니다.
디폴트값인 0부터 255로 하니 잘되네요 ^^
__________________________________________________
좀 더 편한 방화벽 스크립트를 만들자...

__________________________________________________
모두 다 Hardy로 업그레이드 하고 있습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.