Java


JAVA.INSEC.USET : Unsafe Session Expiration Time (Java)

Summary

Session expiration is set to an unsafe value. This could lead to the reuse of old session credentials or session IDs for authorization.

Properties

Class Name Unsafe Session Expiration Time (Java)
Significance security
Mnemonic JAVA.INSEC.USET
Categories
CWE CWE:613 Insufficient Session Expiration
Availability Available for Java only.
Enabling Checks for this warning class are enabled by default. To disable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Unsafe Session Expiration Time (Java)"

Example

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UnsafeSessionTest extends HttpServlet {
    @Override
    public final void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

        HttpSession sesssion = request.getSession(true);
        sesssion.setMaxInactiveInterval(-1); // 'Unsafe Session Expiration Time (Java)' warning issued here:
                                             // - A negative setting indicates that the session will never expire.
        // ...
    }
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.