2010-11-01 47 views
21

Cada vez que una dirección URL que tiene %2F que es el código hexadecimal para / se ha publicado en mi servidor JBoss, me sale un error:Recibe un error HTTP 400 si% 2F es parte de la URL GET en JBOSS

HTTP 400 Bad Request error message. 

Aquí está la URL:

http://localhost:8080/application/**abc%2Fhi**?msg=hello" 

Si quito el %2F de la URL del enlace funciona bien.

Este %2F tiene que ser parte de la URL y no puede ser un parámetro de solicitud.

+0

¿Es esto sólo un problema con '% 2F' o también con otros'% xx'-es? Intente, por ejemplo, '% 7A' o algo ... –

+0

Busque en el registro de errores para obtener más detalles –

+0

El problema es solo con% 2F no para% xx –

Respuesta

53

Finalmente se descubrió la causa de esto (tanto para JBoss como para Apache). Ambas aplicaciones rechazan intencionadamente URI con una barra diagonal codificada (%2F para / y %5C para \) para evitar posibles vulnerabilidades de seguridad.

Enlaces:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0450

http://securitytracker.com/id/1018110 (Mira la sección 4. Solución)

Y aquí están las instrucciones que se le para habilitar este comportamiento en JBoss:

Note: In response to CVE-2007-0450, JBoss AS considers encoded slashes and backslashes in URLs invalid and its usage will result in HTTP 400 error. It is possible to allow encoded slashes and backslashes by following the steps outlined below, however doing so will expose you to CVE-2007-0450 related attacks:

a) If you use the /var/lib/jbossas/bin/run.sh setup, please edit /etc/jbossas/run.conf and append

- -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

- -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true to the string assigned to JAVA_OPTS

b) If you use the init script setup to run multiple JBoss AS services and you wish to allow encoding by default on all services, please edit /etc/jbossas/jbossas.conf and add the line JAVA_OPTS="${JAVA_OPTS}

- -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

- -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true"

c) If you use the init script setup to run multiple JBoss AS services and want to allow encoding of slashes and backslashes for a particular service, please edit /etc/sysconfig/${NAME} (where NAME is the name of your service) and add the line JAVA_OPTS="${JAVA_OPTS} - -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true - -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true"

Para Apache, es tan simple como configurar "AllowEncodedSlashes NoDecode" en algún lugar de tu apache conf o vhost conf (no funciona n un .htaccess, sin embargo).

enlace Apache: http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes

+0

Gracias por su análisis detallado y solución. –

+0

thx Mehaase para la increíble explicación ... – swati

Cuestiones relacionadas