mod_security ¼³Ä¡ ÈÄ ÆÄÀÏ ¾÷·Îµå°¡ ¾ÈµÇ´Â »óȲÀÔ´Ï´Ù.

dragoune   
   Á¶È¸ 1787   Ãßõ 0    

안녕Ȣ16;세요 1901;팔리면 1656;문Ȣ16;1648; 말라고 써1080;lj16;데 그래도 먹고 살/140;고(...) 1656;문 올립니다.
1060;틀 ፆ1;1656;했lj16;데 안됐1004;니 고견1012; 여쭙고1088; 합니다.

1656;문1008; 아래와 같습니다.

mod_security에서 DetectionOnly ON 에서lj16; 안,152;리lj16;데,
DetectionOnly OFF 상태에서lj16; 블럭.104;lj16; ᅆ1;우 Ǻ12;떻,172; 원1064;1060; .104;lj16; 룰1012; 찾아야 할까요?


환ᅆ1;1008; Rocky Linux 8.9 / apache 2.4 / php 8.4

mod_securitylj16; dnf/196; 설치했1004;며 버1204;1008;
mod_security-2.9.6-1.el8.x86_64 1077;니다.


기본1201;1004;/196;lj16; CentOS7 시1208;에 Ǹ16;Nj12; ,163;들1012; 그대/196; 가1256;온 상태1060;며
mod_security 설1221;도 그대/196; 1077;니다.
파1068; 업/196;드를 Ȣ16;면 파1068;1060; 업/196;드 .104;1648; 않lj16; 상황1064;데

SecRuleEngine DetectionOnly Ꮢ1;션1012; 활성화 한 상태/196;lj16;
NJ17;연7176; 파1068; 업/196;드가 .104;고 Ǻ12;떠한 에러/디버그 메시1648;도 나타나1648; 않습니다.

audit.log
modsec_audit.log
modsec_debug.log

SecRuleEngine DetectionOnly Ꮢ1;션1012; 꺼서 실1228;/196; 블럭Ȣ16;,172; 한 상황에서lj16;

modsec_debug.log에서
[18/Mar/2024:11:28:59] [localhost/sid#563f93697640][rid#7f103401de20][/api/front/index/][1] Multipart parsing error: Multipart: Final boundary missing.

요런,172; 찍7176;고요
apache error /196;그에lj16;

[Mon Mar 18 11:28:59] [:error] [pid 2207392:tid 139707031746304] [client ::1:57880] [client ::1] ModSecurity: Multipart parsing error: Multipart: Final boundary missing. [hostname "localhost"] [uri "/api/front/index/"] [unique_id "Zfem6yDs7FhPxjvCHrnUQgAAANM"]

[Mon Mar 18 11:28:59.738473 2024] [proxy_fcgi:error] [pid 2207392:tid 139707249825536] [client 201.xxx.xxx.174:60428] AH01071: Got error 'PHP message: PHP Warning:  file_get_contents(https://localhost/api/front/index/?lang=ja&ckey=audio&akey=add): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error\r\n in /public_html/Component/Component.php on line 118\n', referer: https://test.xxxxxxxx.com/auto/audio/add/?lang=ja


요런식1004;/196; 찍7176;더군요
Component.php on line 118 lj16; 업/196;드한 파1068;1012; 1069;Ǻ12;들1060;lj16; ǥ12;ǥ16;1060;라 localhost/196; Nj12;1276;1012; ǐ12; 실1228; 파1068;1060; 업/196;드.104;1648; 않아서 0156;생Ȣ16;lj16; ,163;1004;/196; 추측Ȣ16;고 1080;습니다. 그/111;다고 1228;가 마1020;대/196; 고칠 수 1080;lj16; ,163;도 아니라...


ModSecurity: Multipart parsing error: Multipart: Final boundary missing. 

/196; ,160;색해보니 대용량 파1068; 업/196;드 시에 0156;생한다lj16; ,163; 같1008;데
파1068; 용량1060; 1MB 1060;Ȣ16;1032; 1089;1008; 파1068;에서 0156;생Ȣ16;고 1080;습니다.

modsecurity.conf 파1068; 설1221;1008; 아래와 같습니다.

<IfModule mod_security2.c>
&#160; &#160; <IfModule unique_id_module>
&#160; &#160; &#160; &#160; SecRuleEngine On
# &#160; &#160; &#160; &#160;SecRuleEngine DetectionOnly
&#160; &#160; &#160; &#160; SecRequestBodyAccess On
&#160; &#160; &#160; &#160; SecDebugLog logs/modsec_debug.log
&#160; &#160; &#160; &#160; SecDebugLogLevel 3
&#160; &#160; &#160; &#160; SecTmpDir /tmp/
&#160; &#160; &#160; &#160; SecUploadDir /tmp/
&#160; &#160; &#160; &#160; SecDataDir /tmp/
&#160; &#160; &#160; &#160; SecAuditEngine On
&#160; &#160; &#160; &#160; SecAuditEngine RelevantOnly
&#160; &#160; &#160; &#160; SecAuditLogType concurrent
&#160; &#160; &#160; &#160; SecAuditLogParts ABIDEFGHZ
&#160; &#160; &#160; &#160; SecAuditLogStorageDir /tmp/
&#160; &#160; &#160; &#160; SecAuditLog logs/audit_log
&#160; &#160; &#160; &#160; SecPcreMatchLimit 100000
&#160; &#160; &#160; &#160; SecPcreMatchLimitRecursion 100000
&#160; &#160; &#160; &#160; SecRequestBodyLimit 13107200
&#160; &#160; &#160; &#160; SecRequestBodyNoFilesLimit 13107200
&#160; &#160; &#160; &#160; SecRequestBodyInMemoryLimit 13107200
&#160; &#160; &#160; &#160; SecRequestBodyLimitAction ProcessPartial

&#160; &#160; &#160; &#160; Include modsecurity.d/crs-setup.conf
&#160; &#160; &#160; &#160; Include /usr/share/mod_modsecurity_crs/rules/*.conf
&#160; &#160; </IfModule>
</IfModule>


/196;그/112;벨 올/160;더니 1068;1068;7176; 나오긴Ȣ16;lj16;데, 너무 많...

고견1012; ǥ12;ᓠ1;드립니다. &#12636;_&#12636;

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
êGPTÇÑÅ× ¹°¾îº¸´Ï ¾Æ·¡ ¼³¸íÀ» ³»³õ´Âµ¥,
 Çѹø ¼³Á¤°ªÀ» È®ÀÎÇغ¸¼¼¿ä..

A: ÁÖ¾îÁø ModSecurity ¼³Á¤¿¡¼­ "Multipart parsing error: Multipart: Final boundary missing"¿Í °°Àº ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ÀǽÉÇغ¼ ¼ö ÀÖ´Â ¸î °¡Áö »çÇ×Àº ´ÙÀ½°ú °°½À´Ï´Ù:

1. SecRequestBodyLimit ¹× °ü·Ã ¼³Á¤ È®ÀÎ: ÁÖ¾îÁø ¼³Á¤¿¡¼­ ¿äû º»¹®ÀÇ Å©±â Á¦ÇÑÀÌ ¼³Á¤µÇ¾î ÀÖ½À´Ï´Ù. ÀÌ ¼³Á¤µéÀ» ÅëÇØ ¿äûÀÇ Å©±â¸¦ Á¦ÇÑÇÏ°í ±×¿¡ µû¸¥ ¹®Á¦¸¦ ¹æÁöÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·¯³ª ÀÌ ¼³Á¤ÀÌ ³Ê¹« ÀÛ°Ô ±¸¼ºµÇ¾î Àְųª, ¸ÖƼÆÄÆ® ¿äûÀÇ Å©±â°¡ ¼³Á¤µÈ Á¦ÇÑÀ» ÃÊ°úÇÏ´Â °æ¿ì¿¡´Â ÀÌ·¯ÇÑ ¹®Á¦°¡ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù.

2. SecRequestBodyInMemoryLimit ¼³Á¤ È®ÀÎ: ÀÌ ¼³Á¤Àº ¿äû º»¹®À» ¸Þ¸ð¸®¿¡ ÀúÀåÇÏ´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ´Â ÃÖ´ë ¸Þ¸ð¸® ¾çÀ» Á¦¾îÇÕ´Ï´Ù. ¸¸¾à ÀÌ ¼³Á¤ÀÌ ³Ê¹« ÀÛ°Ô ±¸¼ºµÇ¾î ÀÖÀ¸¸é Å« ¸ÖƼÆÄÆ® ¿äûÀ» ó¸®ÇÒ ¶§ ¹®Á¦°¡ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù.

3. SecRequestBodyLimitAction ¼³Á¤ È®ÀÎ: ÀÌ ¼³Á¤Àº ¿äû º»¹®ÀÇ Å©±â Á¦ÇÑ¿¡ µµ´ÞÇßÀ» ¶§ ModSecurity°¡ ¾î¶»°Ô µ¿ÀÛÇØ¾ß ÇÏ´ÂÁö¸¦ Á¦¾îÇÕ´Ï´Ù. ¿¹¸¦ µé¾î, "ProcessPartial"·Î ¼³Á¤µÈ °æ¿ì, ¿äûÀÇ ÀϺθ¦ ó¸®ÇÏ°í ³ª¸ÓÁö¸¦ ¹«½ÃÇÕ´Ï´Ù. ÀÌ ¼³Á¤ÀÌ ÀûÀýÇÏ°Ô ±¸¼ºµÇ¾î ÀÖ´ÂÁö È®ÀÎÇØ¾ß ÇÕ´Ï´Ù.

¸ÖƼÆÄÆ® °ü·Ã ·ê È®ÀÎ: CRS (Core Rule Set)¿Í °ü·ÃµÈ ·ê ¼¼Æ®¸¦ Æ÷ÇÔÇÏ´Â ÆÄÀÏ¿¡´Â ¸ÖƼÆÄÆ® ¿äûÀ» ó¸®ÇÏ´Â µ¥ ÇÊ¿äÇÑ º¸¾È ±ÔÄ¢ÀÌ Æ÷ÇԵǾî ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. ÀÌ·¯ÇÑ ·êÀ» ÅëÇØ ¸ÖƼÆÄÆ® ¿äûÀÇ À¯È¿¼ºÀ» °Ë»çÇÏ°í °ü·ÃµÈ ¹®Á¦¸¦ ¹æÁöÇÒ ¼ö ÀÖ½À´Ï´Ù.

ÁÖ¾îÁø ¼³Á¤¿¡¼­´Â CRS (Core Rule Set)¿Í °ü·ÃµÈ ¼³Á¤µµ Æ÷ÇԵǾî ÀÖÀ¸¹Ç·Î, CRSÀÇ ¸ÖƼÆÄÆ® °ü·Ã ·êÀ» ÅëÇØ Ãß°¡ÀûÀÎ º¸È£ ±â´ÉÀ» È°¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.


Q: À§ ¼³Á¤¿¡¼­ ÇöÀç SecRequestBodyLimit ¼³Á¤Àº ¿ë·®À» ¾ó¸¶¸¦ ÀǹÌÇϴ°¡? ¸Þ°¡¹ÙÀÌÆ®·Î..
A: SecRequestBodyLimit ¼³Á¤Àº "13107200"À¸·Î µÇ¾î ÀÖ½À´Ï´Ù. ÀÌ °ªÀº ¹ÙÀÌÆ® ´ÜÀ§·Î Ç¥½ÃµÇ¸ç, ¸Þ°¡¹ÙÀÌÆ®·Î º¯È¯ÇÏ¸é ´ÙÀ½°ú °°ÀÌ µË´Ï´Ù:

13107200 ¹ÙÀÌÆ® = 13107200 / 1024 / 1024 ≈ 12.5 ¸Þ°¡¹ÙÀÌÆ®

µû¶ó¼­ SecRequestBodyLimit ¼³Á¤Àº ¾à 12.5 ¸Þ°¡¹ÙÀÌÆ®ÀÔ´Ï´Ù. ÀÌ ¼³Á¤Àº ¿äû º»¹®ÀÇ ÃÖ´ë Å©±â¸¦ ÁöÁ¤ÇÏ´Â °ÍÀ¸·Î, Ŭ¶óÀ̾ðÆ®°¡ ¼­¹ö·Î Àü¼ÛÇÒ ¼ö ÀÖ´Â ¿äû º»¹®ÀÇ ÃÖ´ë Å©±â¸¦ Á¦ÇÑÇÏ´Â ¿ªÇÒÀ» ÇÕ´Ï´Ù.
     
dragoune 03-18
°¨»çÇÕ´Ï´Ù.
crs ·êÀº ±âº»ÀûÀ¸·Î »ç¿ëÇÏ°í ÀÖ´Â ·ê¼ÂÀÌ°í, ÇöÇà ½Ã½ºÅÛ¿¡¼­´Â ¹®Á¦¾øÀÌ ÀÛµ¿ÇÏ°í ÀÖ½À´Ï´Ù.
¸¸¾à ·ê¼ÂÀ» º¯°æÇÑ´Ù¸é ÇöÀç »ç¿ëÇÏ´Â ½Ã½ºÅÛ°ú ÀÏ°ü¼º¿¡¼­ ¹®Á¦°¡ »ý±â±â ¶§¹®¿¡ °¡´ÉÇÑÇÑ ±×´ë·Î »ç¿ëÇÏ·Á°í ÇÕ´Ï´Ù.

SecRequestBody*Limit ·êÀÇ °æ¿ì ¿ø·¡´Â ¼³Á¤ÇÏÁö ¾Ê°í »ç¿ëÇÏÁö¸¸ Ȥ½Ã³ªÇؼ­ ³Ö¾îº» ¼³Á¤ÀÔ´Ï´Ù.
»ç¿ëÇÏ´Â ÆÄÀÏÀÇ ¿ë·®Àº 1MB ÀÌÇÏÀ̱⠶§¹®¿¡ ¸í½ÃÀûÀ¸·Î 12MB Á¤µµ ¼³Á¤ÇÏ¸é ¹®Á¦°¡ ¾øÀ»°Å¶ó »ý°¢Çߴµ¥ °³¼±µÇÁö ¾Ê°í ÀÖ½À´Ï´Ù. ¤Ì_¤Ì
À½.. Àú´Â modsecurity 2.9.7 ·Î Å×½ºÆ® ÁßÀä. OWASP Modsecurity Core Rule Set ¼®´ÞÁ¤µµ Àü¿¡ ¼³Ä¡ÇÑ ·ê¼Â¿¡
À§ ¼³Á¤À¸·Î ·Îµå¸¦ ÇÏ°í °£´ÜÇÑ ¾÷·Îµå ÆäÀÌÁö ÀÛ¼ºÇؼ­ Å×½ºÆ®¸¦ Çغôµ¥, ¼³Á¤¿¡´Â º° ¹®Á¦ ¾øÀÌ ¾÷·Îµå´Â µÇ³×¿ä..

´Ù¸¸ Å×½ºÆ®¸¦ À§Çؼ­SecRequestBodyLimit  ¿É¼Ç°ªÀ» 13107 ·Î ÁÙÀÌ°í ÀÛÀº À̹ÌÁö ÆÄÀϵîÀ» ¾÷·Îµå ÇßÀ»¶§
±âÁ¸ ¼³Á¤À¸·Î´Â Àß ¿Ã¶ó°¬´Âµ¥ ¹ÝÇØ Á¦ÇÑÀÌ °É¸° °æ¿ì ¾Æ·¡¿Í °°Àº ·Î±×·Î Â÷´ÜµÇ±ä Çß½À´Ï´Ù. Âü°í°¡ µÉÁö ¸ð¸£°Ú½À´Ï´Ù.

[18/Mar/2024:13:57:57.096980 +0900] [¾ÆÀÌÇÇ/sid#55cda7aa9d28][rid#7fb898007ac0][/up.html][2] Warning. Pattern match "^[\\d.:]+$" at REQUEST_HEADERS:Host. [file "/°æ·Î/apache/coreruleset/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "736"] [id "920350"] [msg "Host header is a numeric IP address"] [data "¾ÆÀÌÇÇ"] [severity "WARNING"] [ver "OWASP_CRS/3.3.5"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/210/272"] [tag "PCI/6.5.10"]
[18/Mar/2024:13:58:01.649251 +0900] [¾ÆÀÌÇÇ/sid#55cda7aa9d28][rid#7fb898027e70][/upload.php][1] Request body (Content-Length) is larger than the configured limit (13107).
[18/Mar/2024:13:58:01.649681 +0900] [¾ÆÀÌÇÇ/sid#55cda7aa9d28][rid#7fb898027e70][/upload.php][1] Request body (Content-Length) is larger than the configured limit (13107).
[18/Mar/2024:13:58:01.649964 +0900] [¾ÆÀÌÇÇ/sid#55cda7aa9d28][rid#7fb898027e70][/upload.php][1] Multipart parsing error: Multipart: Final boundary missing.


¹öÁ¯ ¾÷µ¥ÀÌÆ®¸¦ Çѹø Çغ¸½Ã´Â °Íµµ ¾î¶³±î »ý°¢µË´Ï´Ù.
Àú´Â ¾Æ·¡ ·¹Æ÷ÁöÅ丮¿¡¼­ ¼Ò½º·Î ¼³Ä¡ Çß¾ú½À´Ï´Ù.

# ModSecurity ¼Ò½º ´Ù¿î·Îµå
# git clone -b v2.9.7 --single-branch https://github.com/SpiderLabs/ModSecurity.git
     
dragoune 03-18
°¨»çÇÕ´Ï´Ù. ¹öÀü¾÷ Çغ¸°Ú½À´Ï´Ù. ¤Ð_¤Ð
     
dragoune 03-18
°¨»çÇÕ´Ï´Ù.

2.9.7 ·Î ¼³Ä¡Çؼ­ ÇØ°áµÆ½À´Ï´Ù.
·êÀº ±×´ë·Î µÎ°í¿ä
OWASP ·ê·Î º¯°æÇصµ ¹®Á¦¾øÀÌ µÇ´Â±º¿ä
...¼Ò½º ¼³Ä¡¸¦ ½È¾îÇÏ´Â »ç¶÷µéÀÌ ¸¹¾Æ¼­ ÅÛÇø´À» ¾Æ¿¡ rpmÀ¸·Î ¸¸µé±â¸¸ÇÏ´Ùº¸´Ï
ÀÌ·± ÀÏÀÌ ´Ù »ý±â³×¿ä ¤»¤»¤»
          
¿Ê.. ÃàÇϵ帳´Ï´Ù. ´ÙÇàÀ̳׿ä.. °í»ýÇϼ̽À´Ï´Ù.
Àúµµ °æÇè ÇÑ ÀûÀÌ ÀÖ¾ú´Âµ¥..

1. TempÆú´õ (Upload folder) ÁöÁ¤.
2. Æú´õ ±ÇÇÑ ¼³Á¤ chmod 777 /Upload folder

ÀÌ·¸°Ô Ç®Àº ÀûÀÌ ÀÖ½À´Ï´Ù. ¿¹Àü ÀÏÀÌÁÒ.
     
dragoune 03-18
´äº¯ °¨»çÇÕ´Ï´Ù.
À§ ¹æ¹ýÀº ÀÌ¹Ì È®ÀÎÀ» Çß¾ú´Âµ¥ ÇØ°áµÇÁö ¾Ê¾Ò¾ú½À´Ï´Ù.
¾Æ¹«·¡µµ 2.9.6 ¹öÀüÀÌ Àú¶û Ä£ÇÏ°í ½ÍÁö ¾Ê¾Ò´ø °Í °°½À´Ï´Ù. ¤Ì_¤Ì


QnA
Á¦¸ñPage 79/440
05-09   2163   ¿øÅÊÀ̹汼ÀÌ
05-09   1316   ¹Ì´ã
05-09   1572   Espial
05-09   1378   Áߺ¹´Ð³Û
05-09   1294   epowergate
05-09   990   FOXBI
05-09   1155   dpp0548
05-09   1226   ¹¹µçÆȾƿä
05-09   1091   ¿µ»êȸ»ó
05-09   1328   NiteFlite9
05-08   1495   Ç®·Îµå½Ã½ºÅÛ
05-08   1408   ¹Ì´ã
05-08   1452   È­¶õ
05-08   3158   HIGE
05-08   1184   Ãູ¼Ò³â
05-08   1299   ¿µ»êȸ»ó
05-08   1034   Rich
05-07   1272   sdlfkjwer
05-07   1449   ¯¯¸Ç
05-07   1343   Á¤ÀǼ®