Sumeru Cyber Security
  • Sumeru Cyber Security
  • Workarounds for prevalent vulnerabilities
    • Version Disclosure
    • Host Header Attack
    • HttpOnly and Secure Flag
    • Security Headers
    • Clickjacking
    • Weak Password
    • Username Enumeration
    • jQuery Outdated
    • Cross-Origin Resource Sharing
    • AWS S3 Bucket Misconfiguration
    • Directory Listing
    • Laravel Debug Enabled
    • Autocomplete and Remember Password Enabled
    • Brute Force Attack
    • Cross Site Request Forgery
    • SQL Injection
    • PhpMyAdmin page Available Publicly
    • Implementation of BASIC Authentication
    • Cache Browsing
    • Insecure Direct Object Reference
    • Active mixed content over https
    • Improper forgot password implementation
    • ASP.NET Debug Enabled
    • Sensitive Data Sent in GET Request
    • Weak CAPTCHA Implementation
    • Csv Injection
    • Cross Site Scripting
    • Web Server Robot.txt Information Disclosure
    • SSL Related Issues
    • Local File Inclusion
    • Weak CAPTCHA Implementation
    • Automated Form Submission
    • Php.ini File Available Publicly
    • ITLP
    • Internal Path Disclosure
    • Insecure Direct Object Reference
    • Access Token Not Expiring After Logout
  • OWASP A09-Security Logging and Monitoring Failures
  • OWASP API09-Improper Inventory Management v1.0
Powered by GitBook
On this page
  • Introduction
  • Impact
  • How to Test
  • How to Fix
  • PHP
  • References

Was this helpful?

  1. Workarounds for prevalent vulnerabilities

Access Token Not Expiring After Logout

PreviousInsecure Direct Object ReferenceNextOWASP A09-Security Logging and Monitoring Failures

Last updated 5 years ago

Was this helpful?

Introduction

The application access token is not expiring after logout.

Impact

An attacker can use the previous access token to perform malicious activities.

How to Test

When click the view to view the record as shown in the below screenshot.

  • In burp suite, go to proxy tab and go to HTTP history. Then sent the captured above request to the repeater by right click on the packet.

Logged out as shown In the below screenshots

As the token is not expiring after logout we can able to view the record when we send the view request. as shown in the below screenshots

How to Fix

We recommend the following:

  • The access token should expiry after the logout of user.

  • Access token should expiry if the user closing the browser without logging out.

  • Access token should have a defined time-out.

PHP

Sample Code(Logout.php):

<?php 
session_start(); 
session_destroy();                              àIt will destroy all the session variable 
unset($_SESSION["user_name"]);   àit will destroy the particular session variable 
header("location: login.php"); 
?> 

PHP Function for Checking Login Session Timeout

Sample Code:

function isLoginSessionExpired() { 
$login_session_duration = 10;  
$current_time = time();  
if(isset($_SESSION['loggedin_time']) and isset($_SESSION["user_id"])){   
if(((time() - $_SESSION['loggedin_time']) > $login_session_duration)){  
return true;  
}  
} 
return false; 
} 

References

Go to the respective site (Eg: )

Open Burp suite Community Edition. Here, is the to configuration on your browser.

http://192.168.43.155/view.php
Blog
https://phppot.com/php/user-login-session-timeout-logout-in-php/