Apache / PHP / HTML - Textarea, отправка формы с переводом строки (клавиша ввода) выдает 403?

0

У меня странная проблема, и это может быть связано скорее с моей конфигурацией Apache, чем с чем-либо еще, но я не уверен, поэтому я прошу об этом здесь.

У меня есть контактная форма, в этой контактной форме есть текстовое поле.

Если я заполняю контактную форму и в тестовой области, я ввожу одну строку текста, например

Test

Форма завершается, и я получаю уведомление по электронной почте. Однако, если внутри текстового поля я делаю следующее:

Test

Test

Я получаю следующее:

403 - Forbidden

Forbidden
You don't have permission to access /contact_us.php on this server.

Для отладки я добавляю в контроллер формы маркер, чтобы остановить скрипт сразу после отправки формы, поэтому у меня есть следующее:

# IF SEND QUERY BUTTON IS CLICKED
if (isset($_POST['sendQuery']) && $_POST['sendQuery'] == 'Send Query')
{
    echo 'HALT HERE';
    exit;
    ...
}

Когда я отправлю форму с помощью:

Test

Я получаю HALT HERE, однако, когда я отправляю с:

Test

Test

Маркер не запускается, и я получаю 403. Вот почему я предполагаю, что, возможно, это может быть связано с Apache, а не только с тем, как я делал что-то в PHP/HTML.

Есть ли у кого-нибудь идеи, что может привести к тому, что это произойдет? Заранее спасибо!

РЕДАКТИРОВАТЬ:

Сервер Apache 2 с mod_security (+ oWasp определения) и mod_evasive.

В php.ini приведено следующее.

disable_functions = php_uname, getmyuid, getmypid, passthru, fpassthru, leak, listen, diskfreespace, tmpfile, link, ignore_user_abord, escapeshellarg, escapeshellcmd, shell_exec, curl_exec, curl_multi_exec, exec, dl, set_time_limit, system, highlight_file, source, show_source, fsocketopen, virtual, posix_ctermid, posix_getcwd, posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_getgrnam, posix_getgroups, posix_getlogin, posix_getpgid, posix_getpgrp, posix_getpid, posix_getppid, posix_getpwnam, posix_getpwuid, posix_getrlimit, posix_getsid, posix_getuid, posix_isatty, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid, posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_times, posix_ttyname, posix_uname, proc_open, proc_close, proc_get_status, proc_nice, proc_terminate, parse_ini_file. ini_alter, popen, phpinfo

В конфигурации vhost я установил:

<LimitExcept GET POST>
     deny from all
</LimitExcept>

Форма HTML:

<form class="remove-bottom" action="" method="post">
...    
<textarea 
    name="userQuery" id="userQuery" 
    cols="40" rows="10" 
    value="" 
    maxlength="2000" 
    class="quarter-bottom" 
></textarea>
...
</form>

Я получаю это в журнале ошибок apache:

[Thu Mar 13 08:06:54 2014] [error] [client my.ip.my.ip] ModSecurity: Rule 7fd0751d6280 [id "950901"][file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_41_sql_injection_attacks.conf"][line "77"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "www.test.com"] [uri "/index.php"] [unique_id "UyFK-mAcYdcAACwKBI8AAAAE"]
[Thu Mar 13 08:06:59 2014] [error] [client my.ip.my.ip] ModSecurity: Rule 7fd0751d6280 [id "950901"][file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_41_sql_injection_attacks.conf"][line "77"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "www.test.com"] [uri "/contact_us.php"] [unique_id "UyFLA2AcYdcAACwKBJAAAAAE"]
[Thu Mar 13 08:06:59 2014] [error] [client my.ip.my.ip] ModSecurity: Rule 7fd075bb3940 [id "-"][file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_55_application_defects.conf"][line "27"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "www.test.com"] [uri "/contact_us.php"] [unique_id "UyFLA2AcYdcAACwKBJAAAAAE"]
[Thu Mar 13 08:06:59 2014] [error] [client my.ip.my.ip] ModSecurity: Warning. Match of "rx (?i:(<meta.*?(content|value)=\\"text/html;\\\\s?charset=|<\\\\?xml.*?encoding=))" against "RESPONSE_BODY" required. [file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_55_application_defects.conf"] [line "23"] [id "981220"] [msg "[Watcher Check] No charset was specified in the HTTP Content-Type header nor the HTML content meta tag."] [data "Content-Type Response Header: text/html"] [tag "WASCTC/WASC-15"] [tag "APP_DEFECT/MISCONFIGURATION"] [tag "http://code.google.com/p/browsersec/wiki/Part2#Content_handling_mechanisms"] [hostname "www.test.com"] [uri "/contact_us.php"] [unique_id "UyFLA2AcYdcAACwKBJAAAAAE"]
[Thu Mar 13 08:06:59 2014] [error] [client my.ip.my.ip] ModSecurity: Rule 7fd074f08b10 [id "-"][file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_55_application_defects.conf"][line "41"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "www.test.com"] [uri "/contact_us.php"] [unique_id "UyFLA2AcYdcAACwKBJAAAAAE"]
[Thu Mar 13 08:06:59 2014] [error] [client my.ip.my.ip] ModSecurity: Warning. Match of "rx (<meta.*?(content|value)=\\"text/html;\\\\s?charset=utf-8|<\\\\?xml.*?encoding=\\"utf-8\\")" against "RESPONSE_BODY" required. [file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_55_application_defects.conf"] [line "36"] [id "981222"] [msg "[Watcher Check]  The charset specified was not utf-8 in the HTTP Content-Type header nor the HTML content meta tag."] [data "Content-Type Response Header: text/html"] [tag "WASCTC/WASC-15"] [tag "MISCONFIGURATION"] [tag "http://websecuritytool.codeplex.com/wikipage?title=Checks#charset-not-utf8"] [hostname "www.test.com"] [uri "/contact_us.php"] [unique_id "UyFLA2AcYdcAACwKBJAAAAAE"]

other_vhosts_access.log показывает:

test.com:80 my.ip.my.ip - - [13/Mar/2014:08:38:47 +0200] "POST /contact_us.php HTTP/1.1" 403 463 "http://www.test.com/contact_us.php" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
  • 0
    Пожалуйста, разместите разметку формы и соответствующие части конфигурации apache.
  • 0
    @arkascha Я добавил дополнительную информацию по запросу, я не слишком уверен, что еще можно применить здесь, спасибо!
Показать ещё 6 комментариев
Теги:
textarea
http-status-code-403

1 ответ

2
Лучший ответ

Мы сталкиваемся с той же проблемой. Мы решили это, удалив это правило из конфигурации ModSecurity.

  • 0
    Мы делали то же самое после того, как долго царапали головы.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню