## Guide to the Secure Configuration of Java Runtime Environment

> with profile Java Runtime Environment (JRE) STIG
> The Java Runtime Environment (JRE) is a bundle developed and offered by Oracle Corporation which includes the Java Virtual Machine (JVM), class libraries, and other components necessary to run Java applications and applets. Certain default settings within the JRE pose a security risk so it is necessary to deploy system wide properties to ensure a higher degree of security when utilizing the JRE. The IBM Corporation also develops and bundles the Java Runtime Environment (JRE) as well as Red Hat with OpenJDK.

The SCAP Security Guide Project
https://www.open-scap.org/security-policies/scap-security-guide
This guide presents a catalog of security-relevant configuration settings for Java Runtime Environment. It is a rendering of content structured in the eXtensible Configuration Checklist Description Format (XCCDF) in order to support security automation. The SCAP content is is available in the `scap-security-guide` package which is developed at https://www.open-scap.org/security-policies/scap-security-guide.
Providing system administrators with such guidance informs them how to securely configure systems under their control in a variety of network roles. Policy makers and baseline creators can use this catalog of settings, with its associated references to higher-level security control catalogs, in order to assist them in security baseline creation. This guide is a catalog, not a checklist, and satisfaction of every item is not likely to be possible or sensible in many operational scenarios. However, the XCCDF format enables granular selection and adjustment of settings, and their association with OVAL and OCIL content provides an automated checking capability. Transformations of this document, and its associated automated checking content, are capable of providing baselines that meet a diverse set of policy objectives. Some example XCCDF Profiles, which are selections of items that form checklists and can be used as baselines, are available with this guide. They can be processed, in an automated fashion, with tools that support the Security Content Automation Protocol (SCAP). The DISA STIG for Java Runtime Environment, which provides required settings for US Department of Defense systems, is one example of a baseline created from this guidance.
Do not attempt to implement any of the settings in this guide without first testing them in a non-operational environment. The creators of this guidance assume no responsibility whatsoever for its use by other parties, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic.

Profile Title | Java Runtime Environment (JRE) STIG
Profile ID | xccdf_org.ssgproject.content_profile_stig-java-upstream

## Revision History

Current version: 0.1.31

- draft (as of 2017-08-11)

## Platforms

- cpe:/a:oracle:jre:
- cpe:/a:sun:jre:
- cpe:/a:redhat:openjdk:
- cpe:/a:ibm:jre:

## Table of Contents

1. Java

1. Configure the deployment.config File

## Checklist

contains 11 rules

### Java [ref]group

Java is a general-purpose computer programming language. It is intended to let application developers "write once, run anywhere." Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As such, the Java runtime environment (JRE) is required to be installed so that Java applications can run. This section provides settings for configuring Java policies to meet compliance settings for Java running on Red Hat Enterprise Linux systems.

Refer to
- https://docs.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/properties.html
for a list of currently supported Java version 6 settings.

Refer to
- https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html
for a list of currently supported Java version 7 settings.

Refer to
- https://docs.oracle.com/javase/8/docs/technotes/guides/jweb/jcp/properties.html
for a list of currently supported Java version 8 settings.

contains 11 rules

### Configure the deployment.config File [ref]group

The `deployment.config` file if used for specifying the System-level `deployment.properties` file. The System-level configuration for Java is configured in `/etc/.java/deployment`. By default, no `deployment.config` file exists. To ensure that the Java `/etc/.java/deployment/deployment.config` file is configured correctly, `deployment.system.config` and `deployment.system.config.mandatory` need to be set correctly.

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

contains 3 rules

#### The Java Configuration File Exists [ref]rule

If the Java configuration file does not exist, it can be added by running:

    $ sudo mkdir -p -m 755 /etc/.java/deployment
    $ sudo touch /etc/.java/deployment/deployment.config
    $ sudo chmod 644 /etc/.java/deployment/deployment.config

Rationale:

The deployment.config file is used for specifying the location and execution of system-level properties for the Java Runtime Environment. By default no deployment.config file exists; thus, no system-wide deployment.properties file exists. Without the deployment.config file, setting particular options for the Java control panel is impossible.

Severity: medium

Identifiers: CCE-, JRE0070-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_CONFIG="/etc/.java/deployment/deployment.config"
    JAVA_DIR="/etc/.java/deployment"

    if [ ! -d ${JAVA_DIR} ] ; then
      mkdir -p -m 755 ${JAVA_DIR}
    fi

    if [ ! -e ${JAVA_CONFIG} ]; then
      touch ${JAVA_CONFIG} && chmod 644 ${JAVA_CONFIG}
    fi

    chmod 644 ${JAVA_CONFIG}

#### Configure the deployment.properties File Path [ref]rule

To ensure that the Java properties file is set in `/etc/.java/deployment/deployment.config`, add or modify `deployment.system.config` to equal `file:///etc/.java/deployment/deployment.properties`.

Rationale:

Without a proper path for the properties file, deployment would not be possible. If the path specified does not lead to a properties file, the value of the 'deployment.system.config.mandatory' key determines how to handle the situation. If the value of this key is true, JRE will not run if the path to the properties file is invalid.

Severity: medium

Identifiers: CCE-, JRE0060-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_CONFIG="/etc/.java/deployment/deployment.config"
    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.system.config=file://${JAVA_CONFIG}$" ${JAVA_CONFIG} && \
    sed -i "s;deployment.system.config=.*;deployment.system.config=file:\/\/${JAVA_PROPERTIES};g" ${JAVA_CONFIG}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.system.config=file://${JAVA_PROPERTIES}" >> ${JAVA_CONFIG}
    fi

#### Configure The Java Deployment Mandatory Setting [ref]rule

To configure the Java mandatory deployment setting, add or modify `deployment.system.config.mandatory` to equal `false` in `/etc/.java/deployment/deployment.config`.

Rationale:

Without a proper path for the properties file, deployment would not be possible. If the path specified does not lead to a properties file, the value of the 'deployment.system.config.mandatory' key determines how to handle the situation. If the value of this key is true, JRE will not run if the path to the properties file is invalid.

Severity: medium

Identifiers: CCE-, JRE0060-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_CONFIG="/etc/.java/deployment/deployment.config"

    grep -q "^deployment.system.config.mandatory=false$" ${JAVA_CONFIG} && \
    sed -i "s/deployment.system.config.mandatory=.*/deployment.system.config.mandatory=false/g" ${JAVA_CONFIG}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.system.config.mandatory=false" >> ${JAVA_CONFIG}
    fi

#### The Java Properties File Exists [ref]rule

If the Java properties file does not exist, it can be added by running:

    $ sudo mkdir -p -m 755 /etc/.java/deployment
    $ sudo touch /etc/.java/deployment/deployment.properties
    $ sudo chmod 644 /etc/.java/deployment/deployment.properties

Rationale:

Each option in the Java control panel is represented by property keys. These keys adjust the options in the Java control panel based on the value assigned to that key. By default no deployment.properties file exists; thus, no system-wide exists. Without the deployment.properties file, setting particular options for the Java control panel is impossible.

Severity: medium

Identifiers: CCE-, JRE0080-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"
    JAVA_DIR="/etc/.java/deployment"

    if [ ! -d ${JAVA_DIR} ] ; then
      mkdir -p -m 755 ${JAVA_DIR}
    fi

    if [ ! -e ${JAVA_PROPERTIES} ]; then
      touch ${JAVA_PROPERTIES} && chmod 644 ${JAVA_PROPERTIES}
    fi

    chmod 644 ${JAVA_PROPERTIES}

#### Disable Java Execution From Untrusted Sources [ref]rule

To ensure that Java cannot execute from untrusted sources, set `deployment.security.askgrantdialog.notinca` to equal `false` in `/etc/.java/deployment/deployment.properties`.

Rationale:

Permitting execution of signed Java applets from un-trusted sources may result in acquiring malware, and risks system modification, invasion of privacy, or denial of service.

Severity: medium

Identifiers: CCE-, JRE0001-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.security.askgrantdialog.notinca=false$" ${JAVA_PROPERTIES} && \
    sed -i "s/deployment.security.askgrantdialog.notinca=.*/deployment.security.askgrantdialog.notinca=false/g" ${JAVA_PROPERTIES}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.security.askgrantdialog.notinca=false" >> ${JAVA_PROPERTIES}
    fi

#### Disable User Access to Untrusted Sources Settings [ref]rule

To ensure that users cannot change the untrusted sources settings, add `deployment.security.askgrantdialog.notinca.locked` to `/etc/.java/deployment/deployment.properties`.

Rationale:

Permitting execution of signed Java applets from un-trusted sources may result in malware running on the system, and risks system modification, invasion of privacy, or denial of service. As such, ensuring users cannot change the permission settings which control the execution of signed Java applets contributes to a more consistent security profile.

Severity: medium

Identifiers: CCE-, JRE0010-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.security.askgrantdialog.notinca.locked$" ${JAVA_PROPERTIES} && \
    sed -i "s/deployment.security.askgrantdialog.notinca\..*/deployment.security.askgrantdialog.notinca.locked/g" ${JAVA_PROPERTIES}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.security.askgrantdialog.notinca.locked" >> ${JAVA_PROPERTIES}
    fi

#### Enable Revocation Checks for Publisher Certificates [ref]rule

To ensure that certificate revocation checks are enabled, set `deployment.security.validation.crl` to equal `true` in `/etc/.java/deployment/deployment.properties`.

Rationale:

Certificates may be revoked due to improper issuance, compromise of the certificate, and failure to adhere to policy. Therefore, any certificate found on a CRL should not be trusted. Permitting execution of an applet published with a revoked certificate may result in spoofing, malware, system modification, invasion of privacy, and denial of service.

Severity: medium

Identifiers: CCE-, JRE0020-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.security.validation.crl=true$" ${JAVA_PROPERTIES} && \
    sed -i "s/deployment.security.validation.crl=.*/deployment.security.validation.crl=true/g" ${JAVA_PROPERTIES}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.security.validation.crl=true" >> ${JAVA_PROPERTIES}
    fi

#### Disable User Access to Revocation Check Settings [ref]rule

To ensure that users cannot change certificate revocation check settings, add `deployment.security.validation.crl.locked` to `/etc/.java/deployment/deployment.properties`.

Rationale:

Permitting execution of an applet published with a revoked certificate may result in spoofing, malware, system modification, invasion of privacy, and denial of service. As such, ensuring users cannot change settings contributes to a more consistent security profile.

Severity: medium

Identifiers: CCE-, JRE0030-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.security.validation.crl.locked$" ${JAVA_PROPERTIES} && \
    sed -i "s/deployment.security.validation.crl\..*/deployment.security.validation.crl.locked/g" ${JAVA_PROPERTIES}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.security.validation.crl.locked" >> ${JAVA_PROPERTIES}
    fi

#### Enable Online Certificate Validation [ref]rule

To ensure that online certificate verification is enabled, set `deployment.security.validation.ocsp` to equal `true` in `/etc/.java/deployment/deployment.properties`.

Rationale:

Online certificate validation provides a greater degree of validation of certificates when running a signed Java applet. Permitting execution of an applet with an invalid certificate may result in malware execution , system modification, invasion of privacy, and denial of service.

Severity: medium

Identifiers: CCE-, JRE0040-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.security.validation.ocsp=true$" ${JAVA_PROPERTIES} && \
    sed -i "s/deployment.security.validation.ocsp=.*/deployment.security.validation.ocsp=true/g" ${JAVA_PROPERTIES}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.security.validation.ocsp=true" >> ${JAVA_PROPERTIES}
    fi

#### Disable User Access to Online Certificate Validation Settings [ref]rule

To ensure that users cannot change the online certificate verification settings, add `deployment.security.validation.ocsp.locked` to `/etc/.java/deployment/deployment.properties`.

Rationale:

Online certificate validation provides a greater degree of validation of certificates when running a signed Java applet. Permitting execution of an applet with an invalid certificate may result in malware execution , system modification, invasion of privacy, and denial of service. As such, ensuring users cannot change settings contributes to a more consistent security profile.

Severity: medium

Identifiers: CCE-, JRE0050-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Remediation Shell script: (show)

Complexity: | low
Disruption: | low
Reboot: | false
Strategy: | disable

    JAVA_PROPERTIES="/etc/.java/deployment/deployment.properties"

    grep -q "^deployment.security.validation.ocsp.locked$" ${JAVA_PROPERTIES} && \
    sed -i "s/deployment.security.validation.ocsp\..*/deployment.security.validation.ocsp.locked/g" ${JAVA_PROPERTIES}
    if ! [ $? -eq 0 ] ; then
      echo "deployment.security.validation.ocsp.locked" >> ${JAVA_PROPERTIES}
    fi

#### Ensure Java Patches Installed [ref]rule

If the system is joined to the Red Hat Network, a Red Hat Satellite Server, or a yum server, run the following command to install updates:

    $ sudo yum update

If the system is not configured to use one of these sources, updates (in the form of RPM packages) can be manually downloaded and installed using `rpm`. Rationale:

Running an older version of the JRE can introduce security vulnerabilities to the system.

Severity: medium

Identifiers: CCE-, JRE0090-UX

References: DCBP-1, http://iase.disa.mil/stigs/cci/Pages/index.aspx

Red Hat and Red Hat Enterprise Linux are either registered trademarks or trademarks of Red Hat, Inc. in the United States and other countries. All other names are registered trademarks or trademarks of their respective companies.