Harden a WebLogic Server Production Environment
Author: Michael Pareene
MSI Systems Integrators
Cell: 612.220.8725
Email: mpareene@msiinet.com
Hardening Procedure
- Fundamental questions that need to be answered first:
- Which resources am I protecting?
- From whom am I protecting the resources?
- Should the system administrators have access to all WebLogic resources?
- Should the system administrators be able to access all data?
- What will happen if the protections on strategic resources fail?
- Hire an independent security expert to go over the security plan and procedures, audit the installed systems, and recommend improvements.
- Review the BEA Advisories & Notifications page and register to receive security advisories notifications.
- Report possible security issues in BEA products to secalert@bea.com.
- Do not install the WebLogic Server sample applications and XML Spy.
When installing WebLogic Server, select the Custom option and unclick the Samples option. At the end of the WebLogic Server installation, unclick the Install XML Spy option.
Note that XML Spy is installed on Windows-platforms only.
- Run with the JRE instead of the Java SDK.
The Javasoft SDK offers a JRE download and installation. When installing WebLogic Server, use the Configuration Wizard and select the JRE option. This option eliminates the Java compiler and other development tools.
- When using JRockit, delete the software components of the Java SDK that are not in the JRockit JRE.
- Delete development tools such as the Configuration Wizard, WebLogic Builder and the jCOM tools if you don't plan to use them in production.
- Delete the Pointbase database which is included for evaluation purposes and it is not supported in the production environments.
- Delete the MedRec sample providers JAR file.
This file is installed even if you chose not to install the sample applications.
- Physically secure the hardware.
Keep your hardware in a secured area to prevent unauthorized users from tampering with the deployment machine or its network connections.
- Secure networking services that the operating system provides.
Have an expert review network services such as the e-mail program or directory service to ensure that a malicious attacker cannot access the operating system or system-level commands. Avoid sharing file systems with other machines in the enterprise network.
- Use a file system that can prevent unauthorized access.
Make sure that the file system on each WebLogic Server host can prevent unauthorized access to protected resources. For example, on a Windows computer, use only NTFS.
- Limit the number of user accounts on the host machine.
Avoid creating multiple user accounts on WebLogic Server hosts, and limit the file access privileges granted to each account. Ideally, the host machine would have one user account with system administrator privileges and one user with sufficient privileges to run WebLogic Server. Review active user accounts regularly and when personnel leave.
Some WebLogic Server configuration data and some URL (Web) resources, including Java Server Pages and HTML pages, are stored in clear text on the file system. A user or intruder with read access to files and directories can defeat any security mechanisms you establish with WebLogic Server authentication and authorization schemes.
- Safeguard passwords.
The passwords for user accounts on production machines should be difficult to guess and should be guarded carefully. Set a policy to expire passwords periodically. Never code passwords in client applications.
- On each host computer, give only one user account access to WebLogic resources.
On each WebLogic Server host computer, use the operating system to establish a special user account (for example, wls_owner) specifically to run WebLogic Server. Grant to this operating-system (OS) user account the following privileges:
- Access privileges only to the BEA Home directory, the WebLogic Server product directory tree, and your domain directories.
The BEA Home directory is a repository for common files that are used by multiple BEA products installed on the same machine. The WebLogic Server product installation directory contains all the WebLogic Server software components that you choose to install on your system, including program files. A domain directory contains the configuration files, security files, log files, J2EE applications, and other J2EE resources for a single WebLogic domain. If you install multiple domains on a WebLogic Server host computer, each domain directory must be protected.
By default, the BEA installation program places all BEA files and your domain directories in a single directory tree, whose top directory is named bea. All WebLogic Server files are a subdirectory of this directory tree (bea\weblogic810), and your domain files are in other subdirectories (bea\user_projects\domains\domain1, bea\user_projects\domains\domain2, ...).
You can, however, locate the WebLogic Server product installation directory and your domain directories outside the BEA Home directory.
- Grant read, write, and execute privileges within the BEA Home directory, the WebLogic Server product directory tree, and your domain directories.
No other OS user should have read, write, or execute access to BEA files and your domain files. This protection limits the ability of other applications executing on the same machine as WebLogic Server to access BEA files and your domain files. Without this protection, some other application could gain write access and insert malicious, executable code in JSPs and other files that provide dynamic content. The code would be executed the next time the file was served to a client.
- Run WebLogic Server Windows services under the special OS user account.
On the Windows platform, you can run a WebLogic Server instance as a Windows service. This causes the server instance to start automatically each time you boot the Windows computer. To set up a WebLogic Server instance to run as a Windows service, log in to the Windows computer with a user account that has privileges to modify the Windows registry.
You do not need these administrator-level privileges to run a WebLogic Server instance as a Windows service. Instead, the Windows service should run under the special OS user account that you created for running WebLogic Server. To ensure that the WebLogic Server instance runs under the special OS user account, provide the username and password on the Windows service's Properties page.
- To bind to protected ports on UNIX, configure WebLogic Server to switch user IDs or use Network Address Translation (NAT) software.
On UNIX systems, only processes that run under a privileged user account (in most cases, root) can bind to ports lower than 1024. However, long-running processes like WebLogic Server should not run under these privileged accounts. Instead, you can do either of the following:
- For each WebLogic Server instance that needs access to privileged ports, configure the server to start under a privileged user account, bind to privileged ports, and change its user ID to a non-privileged account.
If you use Node Manager to start the server instance, configure Node Manager to accept requests only on a secure port and only from a single, known host.
- Start WebLogic Server instances from a non-privileged account and configure your firewall to use Network Address Translation (NAT) software to map protected ports to unprotected ones. BEA does not provide NAT software.
- Do not develop on a production machine.
Develop first on a development machine and then move code to the production machine when it is completed and tested. This process prevents bugs in the development environment from affecting the security of the production environment.
- Do not install development and sample software on a production machine.
Do not install development tools on production machines. Keeping development tools off the production machine reduces the leverage intruders have should they get partial access to a WebLogic Server production machine. Do not install the WebLogic Server sample applications on a production machine. When the BEA installation program asks whether you want a Typical Installation or Custom Installation:
- Choose Custom Installation. Then click Next.
- On the Choose Components page, remove the check mark from the Server Examples check box. Then click Next.
- Enable security auditing.
If the operating system on which WebLogic Server runs supports security auditing of file and directory access, BEA recommends using audit logging to track any denied directory or file access violations.
- Consider using additional software to secure your operating system.
Most operating systems can run additional software to secure a production environment. For example, an Intrusion Detection System (IDS) can detect attempts to modify the production environment. Refer to the vendor of your operating system for information about available software.
- Apply operation-system service packs and security patches.
Refer to the vendor of your operating system for a list of recommended service packs and security-related patches.
- Apply the latest BEA service packs and implement the latest security advisories.
If you are responsible for security related issues at your site, register on the BEA Advisories & Notifications page to receive notifications of newly available security advisories. Remedies recommended in the security advisories are posted on the Advisories & Notifications page. In addition, you are advised to apply each service pack as it is released. Service packs include a roll-up of all bug fixes for each version of the product, as well as each of the previously released service packs. You can download service packs from...
http://commerce.beasys.com/downloadsReport possible security issues in BEA products to secalert@bea.com.
- Use hardware and software to create firewalls.
A firewall limits traffic between two networks. Firewalls can be a combination of software and hardware, including routers and dedicated gateway machines. They employ filters that allow or disallow traffic to pass based on the protocol, the service requested, routing information, packet content, and the origin and destination hosts or networks. They can also limit access to authenticated users only.
The WebLogic Security Service supports the use of third-party Identity Assertion providers, which perform perimeter-based authentication (Web server, firewall, VPN) and handle multiple security token types/protocols (SOAP, IIOP-CSIv2).
- Use WebLogic Server connection filters.
Instead of, or in addition to, using hardware and third-party software to create firewalls, consider using connection filters to limit network traffic based on protocols, IP addresses, and DNS node names. Connection filters are most appropriate when the machines in a WebLogic Server domain can access each other without going through a firewall. For example, you might use a firewall to limit traffic from outside the network, and then use connection filters to limit traffic behind the firewall.
- Use a domain-wide Administration Port for administrative traffic.
An Administration Port limits all administrative traffic between server instances in a WebLogic Server domain to a single port. When used in conjunction with a connection filter, you can specify that a WebLogic Server instance accepts administrative requests only from a known set of machines or subnets and only on a single port. You enable the domain wide Administration Port in the Administration Console on the tab...
DomainName | Configuration | General- Secure Your Database
Most Web applications use a database to store their data. Common databases used with WebLogic Server are Oracle, Microsoft SQL Server, and Informix. The databases frequently hold the Web application's sensitive data including customer lists, customer contact information, credit card information, and other proprietary data. When creating your Web application consider what data is going to be in the database and how secure you need to make that data. You also need to understand the security mechanisms provided by the manufacturer of the database and decide whether they are sufficient for your needs. If the mechanisms are not sufficient, you can use other security techniques to improve the security of the database, such as encrypting sensitive data before writing it to the database. For example, leave all customer data in the database in plain text except for the encrypted credit card information.
- Apply the latest BEA service packs and implement the latest security advisories.
If you are responsible for security related issues at your site, register on the BEA Advisories & Notifications page to receive notifications of newly available security advisories. Remedies recommended in our security advisories are posted on the Advisories & Notifications page. In addition, you are advised to apply each service pack as it is released. Service packs include a roll-up of all bug fixes for each version of the product, as well as each of the previously released service packs. Download service packs from http://commerce.beasys.com/downloads.
Report possible security issues in BEA products to secalert@bea.com.
- Deploy production-ready security providers to the security realm.
The WebLogic Security Service uses a pluggable architecture in which you can deploy multiple security providers, each of which handles a specific aspect of security. By default WebLogic Server includes its own security providers that provide a complete security solution. If you have purchased or written your own security providers:
- Make sure that you have deployed and configured them properly. You can verify which security providers are currently deployed in the Administration Console under...
Security | Realms | RealmName | Providers
- Make sure that the realm in which you deployed your security providers is the default (active) realm. You activate a realm in the Administration Console by clicking on the name of the Security realm folder in the left pane and then specifying Domain Wide Security Settings in the right pane.
- Use SSL, but do not use the demonstration digital certificates in a production environment.
To prevent sensitive data from being compromised, secure data transfers by using the SSL and the HTTPS protocol (HTTP over the Secure Sockets Layer (SSL)) rather than the HTTP protocol. WebLogic Server includes a set of demonstration private keys, digital certificates, and trusted certificate authorities that are for development only. Everyone who downloads WebLogic Server has the private keys for these digital certificates. Do not use the demonstration identity and trust.
- Enable maximum-strength encryption.
The version of WebLogic Server that you download supports 512-bit keys and 40-bit bulk encryption. If you want to use a version that supports maximum-strength encryption (1024-bit keys with 128-bit bulk encryption), contact your BEA sales representative. Because of export restrictions, this version of WebLogic Server is available only for customers in specific countries.
- Make sure that WebLogic Server enforces security constraints on digital certificates.
- When communicating via SSL, by default WebLogic Server rejects any digital certificates in a certificate chain that do not have the Basic Constraint extension defined by the Certificate Authority. This level of enforcement protects your Web site from the spoofing of digital certificates. Make sure that no server startup command includes the following option, which disables this enforcement:
-Dweblogic.security.SSL.enforceConstraints=falseThis option could be located in a startup script, or, if you use the Node Manager to start Managed Servers, in the Administration Console on...
Servers | ServerName | Configuration | Remote Start OptionsIn your development environment, you might have disabled the enforcement of security constraints to work around incompatibilities with demonstration digital certificates that WebLogic Server provided in releases prior to 7.0 Service Pack 2. Make sure you enable this feature in your production environment.
- Verify that host name verification is enabled to avoid man-in-the-middle attacks.
By default, the WebLogic SSL implementation validates that the host to which a connection is made is the intended or authorized party. However, during the implementation of WebLogic Server at your site, you might have disabled host name verification. You can enable host name verification in the Administration Console on...
Servers | ServerName | Configuration | Keystores & SSLA man-in-the-middle attack occurs when a machine inserted into the network captures, modifies, and retransmits messages to the unsuspecting parties. One way to avoid man-in-the-middle attacks is to validate that the host to which a connection is made is the intended or authorized party. An SSL client can compare the host name of the SSL server with the digital certificate of the SSL server to validate the connection. The WebLogic Server HostName Verifier protects SSL connections from man-in-the-middle attacks. Restrict the size and the time limit of requests to prevent denial of service attacks.
To prevent some denial of service attacks, WebLogic Server can restrict the size of a message as well as the maximum time it takes a message to arrive. The default settings allow 2 gigabytes for the maximum message size and 480 seconds for the complete message timeout. You can configure these settings for the HTTP, T3, and IIOP protocols in the Administration Console under... Servers | ServerName | ProtocolsRefer to the following tasks in the Administration Console Online Help:
A denial of service attack leaves a Web site running but unusable. Hackers deplete or delete one or more critical resources of the Web site. To perpetrate a denial of service attack on a WebLogic Server instance, an intruder bombards the server with many requests that are very large, are slow to complete, or never complete so that the client stops sending data before completing the request.
By default, the WebLogic Security Service provides maximum security against dictionary attacks of user accounts. If during development you changed the settings for the number of invalid login attempts required before locking the account, the time period in which invalid login attempts have to take place before locking the account, or the amount of time the user account is locked, review the settings and verify that they are adequate for your production environment.
You verify or change these settings in the Administration Console....
Security | Realms | RealmName | User LockoutsIn a dictionary attack, a hacker sets up a script to attempt logins using passwords out of a "dictionary." The WebLogic Server user lockout and login settings can protect user accounts from dictionary attacks.
- Configure user lockouts and login time limits to prevent attacks on user accounts.
- If you use multiple Authentication providers, set the JAAS control flag.
If a security realm has multiple Authentication providers configured, configure the order and precedence of each provider by setting the JAAS control flags. You set the JAAS control flag in the Administration Console on the Security | Realms | RealmName | Providers | Authentication | AuthenticatorName | General tab.
- Enable security auditing
Auditing is the process of recording key security events in your WebLogic Server environment. When the Auditing provider that the WebLogic Security Service provides is enabled, it logs events in DomainName\DefaultAuditRecorder.log You enable an Auditing provider in the Administration Console on...
Security | Realms | RealmName | Providers | AuditingNote: Using an Auditing provider might adversely affect the performance of WebLogic Server even if only a few events are logged. Review the auditing records periodically to detect security breaches and attempted breaches. Noting repeated failed logon attempts or a surprising pattern of security events can prevent serious problems.
- Ensure that you have correctly assigned users and groups to the default WebLogic Server security roles.
By default, all WebLogic resources are protected by security policies that are based on a default set of security roles. Make sure you have assigned the desired set of users and groups to these default security roles.
- Consider preventing WebLogic Server from sending its name and version number in HTTP responses.
By default, when an instance of WebLogic Server responds to an HTTP request, its HTTP response header includes the server's name and WebLogic Server version number. This poses a potential security risk if an attacker knows about a vulnerability in the specific version of WebLogic Server. To prevent a WebLogic Server instance from sending its name and version number, disable the Send Server Header attribute in the Administration Console. The attribute is located on...
Server | ServerName | Configuration | Protocols | | Advanced Options | HTTP- Determine which technique secures your Web applications and EJBs.
By default, each Web application and EJB uses deployment descriptors (XML files) to declare its secured resources and the security roles that can access the secured resources. Instead of declaring security in Web application and EJB deployment descriptors, you can use the Administration Console to set security policies that secure access to Web applications and EJBs. This technique provides a single, centralized location from which to manage security for all Web applications and EJBs. You can combine these two techniques and configure WebLogic Server to copy security configurations from existing deployment descriptors upon the initial deployment of a URL (Web) or EJB resource. Once these security configurations are copied, the Administration Console can be used for subsequent updates.
- Use JSP comment tags instead of HTML comment tags.
Comments in JSP files that are not meant for the end user should use the JSP syntax of <%/* ... */%> instead of the HTML syntax <!-- ... -->. The JSP comments are deleted when the JSP is compiled and therefore cannot be viewed.
- Do not install uncompiled JSPs and other source code on the production machine.
Always keep source code off of the production machine. Getting access to your source code allows an intruder to find security holes. Consider precompiling JSPs and installing only the compiled JSPs on the production machine.
- Configure your applications to use SSL.
Set the transport-guarantee to CONFIDENTIAL in the user-data-constraint element of the web.xml file.
- Do not use the Servlet servlet.
BEA does not recommend using the Servlet servlet in a production environment. Instead, map servlets to URIs explicitly. Remove all existing mappings between WebLogic servlets and the Servlet servlet from all Web applications before using the applications in a production environment.
- Do not leave FileServlet as the default servlet in a production environment.
- Verify all WebLogic security policies.
Verify you have not removed security policies from WebLogic resources, and make sure that your security role assignments provide users the kind of access that you intend.
- Examine applications for security
There are instances where an application can lead to a security vulnerability. Many of these instances are defined by third-party organizations such as Open Web Application Security project. Of particular concern is code that uses Java native interface because Java positions native code outside of the scope of Java security. If Java native code behaves errantly, it is only constrained by the operating system. That is, the Java native code can do anything WebLogic Server itself can do. This vulnerability is further complicated by the fact that buffer overflow errors are common in native code and can introduce arbitrary code.
- If your applications contain untrusted code, enable the Java security manager.
The Java security manager defines and enforces permissions for classes that run within a JVM. In many cases, where the threat model does not include malicious code being run in the JVM, the Java security manager is unnecessary. However, when third-parties use WebLogic Server and unknown classes are being run, the Java security manager may be useful. To enable the Java security manager for a server instance, use the following Java options when starting the server:-Djava.security.manager
-Djava.security.policy[=]=filename- Replace HTML special characters when servlets or JSPs return user-supplied data.
The ability to return user-supplied data can present a security vulnerability called cross-site scripting, which can be exploited to steal a user's security authorization.
To remove the security vulnerability, before you return data that a user has supplied, scan the data for HTML special characters. If you find any such characters, replace them with their HTML entity or character reference. Replacing the characters prevents the browser from executing the user-supplied data as HTML.
See: