How to Disable Http Methods
How to Disable Http Methods
2850003.1)
In this Document
APPLIES TO:
GOAL
How to restrict HTTP Method such as PUT, OPTION, DELETE and etc. to
OHS requests.
For example, Only GET and POST access want to be allowed.
SOLUTION
Example1:
The following example will only allow GET and POST requests for
DocumentRoot:
httpd.conf
DocumentRoot "${ORACLE_INSTANCE}/config/fmwconfig/components/${COMPONENT_TYPE}/
instances/${COMPONENT_NAME}/htdocs"
<Directory "${ORACLE_INSTANCE}/config/fmwconfig/components/${COMPONENT_TYPE}/
instances/${COMPONENT_NAME}/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
# Require all granted
Require method GET POST
</Directory>
Example2:
The following example will only allow GET and POST requests for the
weblogic request path "/weblogic/*":
mod_wl_ohs.conf
<Location /weblogic>
SetHandler weblogic-handler
WebLogicHost <WLS_HOST>
WebLogicPort <WLS_PORT>
Require method GET POST
</Location>
OHS returns HTTP 403 Forbidden response for PUT request because
/weblogic access is restricted via GET and POST in above
mod_wl_ohs.conf.
In this Document
Goal
Solution
References
APPLIES TO:
GOAL
This article describes a way to disable this HTTP TRACE method within the Oracle HTTP
Server (OHS) using a rewrite to a Forbidden page, which has been a popular configuration.
The same concept will apply to other methods, in case you decide to further limit request
methods to the server:
GET, POST, HEAD, PUT, DELETE, TRACE, OPTIONS, MOVE, INDEX, MKDIR,
RMDIR
Note: GET and POST are the most popular in any web page, and you likely do not want to disable
these.
Note:
TRACE was used for this article for the rewrite option because it has been a popular request. It is also
a recommendation in the 10.1.3.4 and 10.1.3.5 Patch Set readme files to restrict TRACE as a security
precaution. (It is still recommended on all versions, it was just that readme that announced that
recommendation). Note that some other methods may be used by Oracle components (and your
applications) in ways not explicitly expressed, and are valid HTTP request methods in use within the
Internet technologies. However, in some cases, an Administrator may wish to disable one or more by
using the rewrite method.
If there is a reason to "restrict" a method because of a security issue, please provide Oracle Support
with a testcase that reproduces and shows the security exploit. If its a third party recommendation,
please have the third party contact Oracle Security directly:
To protect against all known, fixed and applicable vulnerabilities, Oracle recommends to applying the
latest Patch Set and then monitor for Critical Patch Updates on your new version:
https://www.oracle.com/technetwork/topics/security/alerts-086861.html
SOLUTION
For Apache version 1.3.34 (or later), or Apache 2.0.55 (or later), there is a new directive if
the only REQUEST_METHOD you wish to restrict is TRACE. For Oracle HTTP Server, this
means versions 10.1.3.1 (or later) or 11.1.1.2 (or later). For these newer versions, configure
the httpd.conf file with the TraceEnable directive:
TraceEnable Off
Updated reference for OHS 12c based on Apache
2.4: https://httpd.apache.org/docs/2.4/mod/core.html#traceenable
To include other methods in the restriction, the remainder of this article describes a way to
disable this HTTP TRACE method within the Oracle HTTP Server (OHS) using a rewrite to
a forbidden page, (which has been a popular configuration). The same concept will apply to
other methods, in case you decide to further limit request methods to the server:
GET, POST, HEAD, PUT, DELETE, TRACE, TRACK, OPTIONS, MOVE, INDEX,
MKDIR, RMDIR
Note: GET and POST are the most popular in any web page, and you likely do not want to disable
these.
The basic configuration for this is to add the following RewriteCond to the httpd.conf (or
other valid .conf file) file, normally placed at the end of the httpd.conf file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
Alternatively, this will reject any request which is using a method not specified in the
directive:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)
RewriteRule .* - [F]
</IfModule>
Notes:
If the installation is an Application Server within a Grid Control/OMS home, the file
$OH/sysman/config/http_em.conf will need the above entries in order to take effect.
There is a known issue with this configuration if applying a Patch Set in the future:
Note 560368.1 "Forbidden" Error After Configuration or Applying 10g Patch Set
RewriteRules from the main server configuration do not apply to VirtualHosts. If this is
specific to a VirtualHost, these rewrites should be with a VirtualHost container. If these rules
are specified in the main configuration, the following two lines are needed within the
VirtualHost container, including the ssl.conf:
RewriteEngine on
RewriteOptions inherit
More information about the scoping of mod_rewrite is available on it's documentation page:
AS 10g:
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
FMW 11g:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
FMW 12c:
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
Unless you have an application that sends a TRACE, this may be hard to test unless you have
a specific TRACE request (which is usually programmable from a script).
The easiest way to verify the rewrite directive is active is to temporarily change the ^TRACE
to ^GET, and make a request to your homepage, the request should fail, as a GET is a normal
request. (A form submit would be a POST method).
(You are actually just testing to see if the RewriteRule is generally active within the
configuration you placed it).
You can easily conclude that if a TRACE was sent the same reaction would occur if
configuring for TRACE.
The telnet command provided with most operating systems can be used to verify that the
configuration changes to disable TRACE have been made. Note that telnet can only be used
to test non-SSL ports, since it does not have the capability to perform the SSL handshake or
to encrypt the data.
$ telnet 127.0.0.1 8080
Trying...
Connected to 127.0.0.1.
Escape character is '^]'.
TRACE / HTTP/1.0
The information sent by the client is no longer echoed, and the request fails with HTTP status
code 403 or 405. If the response to the TRACE request continues to result in a response with
status code 200, verify that the required directives were added to all <VirtualHost >
containers and the main scope of the configuration file, and also verify that the web server
has been restarted to activate the updated configuration.
1. Download curl package if it is not already installed. This is not an Oracle utility, but
available on the Internet, depending on your environment.
REFERENCES