Headline
CVE-2023-40174: added session expiration · fobybus/social-media-skeleton@99738b2
Social media skeleton is an uncompleted/framework social media project implemented using a php, css ,javascript and html. Insufficient session expiration is a web application security vulnerability that occurs when a web application does not properly manage the lifecycle of a user’s session. Social media skeleton releases prior to 1.0.5 did not properly limit manage user session lifecycles. This issue has been addressed in version 1.0.5 and users are advised to upgrade. There are no known workarounds for this vulnerability.
Skip to content
Actions
Automate any workflow
Packages
Host and manage packages
Security
Find and fix vulnerabilities
Codespaces
Instant dev environments
Copilot
Write better code with AI
Code review
Manage code changes
Issues
Plan and track work
Discussions
Collaborate outside of code
GitHub Sponsors
Fund open source developers
* The ReadME Project
GitHub community articles
- Pricing
Search code, repositories, users, issues, pull requests…
Provide feedback
Saved searches****Use saved searches to filter your results more quickly
Sign up
Notifications
Fork 2
Code
Issues
Pull requests
Discussions
Actions
Projects
Security
Insights
Commit
Permalink
Browse files
Browse the repository at this point in the history
added session expiration
- Loading branch information
Showing 10 changed files with 70 additions and 2 deletions.
- add.php
- setting.php
- home.php
- login.php
- mg.php
- login.php
- passw.php
- home.php
- profile.php
- setting.php
7 changes: 7 additions & 0 deletions admin/atask/add.php
Expand Up
@@ -9,6 +9,13 @@
exit();
}
//is expired
if(sexpired())
{
header(“location:logout.php”);
exit();
}
if($_SERVER[‘REQUEST_METHOD’] == ‘POST’)
{
$uemail=htmlspecialchars($_POST[“email”], ENT_QUOTES, ‘UTF-8’);
Expand Down
8 changes: 8 additions & 0 deletions admin/atask/setting.php
Expand Up
@@ -8,6 +8,14 @@
header(“location:…/adminlogin.html”);
exit();
}
//is expired
if(sexpired())
{
header(“location:logout.php”);
exit();
}
//connect to the database first!!!
require(‘…/…/tasks/condb.php’);
if($_SERVER[‘REQUEST_METHOD’] == ‘POST’)
Expand Down
9 changes: 9 additions & 0 deletions admin/home.php
@@ -1,12 +1,21 @@
<!-- drop in and out of the PHP context -->
<?php
include(“atask/getinfo.php”);
include(“…/tasks/passw.php”);
session_start();
if(!isset($_SESSION[“aid”]))
{
header(“location:adminlogin.html”);
}
//is expired
if(sexpired())
{
header(“location:atask/logout.php”);
exit();
}
?>
<html lang="en-us">
Expand Down
1 change: 1 addition & 0 deletions admin/login.php
Expand Up
@@ -31,6 +31,7 @@
$_SESSION[“aid”]=$id;
$_SESSION[“password”]=$pass;
$_SESSION[“salt”]=$salt;
$_SESSION[“exp_time”]=time()+(10);
header(“location:home.php”);
} else {
echo "<p style=’color:red;text-align:center;font-size:20px;’> incorrect password </p>";
Expand Down
9 changes: 9 additions & 0 deletions admin/mg.php
@@ -1,10 +1,19 @@
<?php
session_start();
include(“…/tasks/passw.php”);
if(!isset($_SESSION[“aid”]))
{
header(“location:adminlogin.html”);
exit();
}
//is expired
if(sexpired())
{
header(“location:atask/logout.php”);
exit();
}
?>
<html lang="en-us">
Expand Down
5 changes: 3 additions & 2 deletions login.php
@@ -1,4 +1,4 @@
<?php
<?php
session_start();
if(isset($_SESSION[“id”]))
{
Expand Down Expand Up
@@ -39,7 +39,7 @@
$upass=hashPass($upass,$salt);
if($upass==$pas)
{
//session start
//session start
$_SESSION[‘email’]=$email;
$_SESSION[“id”]=$id;
$_SESSION[“fname”]=$fname;
Expand All
@@ -51,6 +51,7 @@
$_SESSION[“edu”]=$edu;
$_SESSION[“joined”]=$joined;
$_SESSION[“salt”]=$salt;
$_SESSION[“exp_time”]=time()+(10);
////////////////////////////
//update last seen
////////////////////////////
Expand Down
9 changes: 9 additions & 0 deletions tasks/passw.php
Expand Up
@@ -14,4 +14,13 @@ function hashPass($plain,$salt)
return hash("sha256",$password);
}
//check se exp
function sexpired()
{
if(isset($_SESSION[“exp_time”]) && $_SESSION[“exp_time”]<time())
return true;
else
return false;
}
?>
9 changes: 9 additions & 0 deletions user/home.php
@@ -1,11 +1,20 @@
<!-- drop in and out of the PHP context -->
<?php
session_start();
require(“…/tasks/passw.php”);
if(!isset($_SESSION[“id”]))
{
header(“location:…/login.html”);
exit();
}
//is expired
if(sexpired())
{
header(“location:logout.php”);
exit();
}
?>
<html lang="en-us">
Expand Down
9 changes: 9 additions & 0 deletions user/profile.php
@@ -1,11 +1,20 @@
<!-- drop in and out of the PHP context -->
<?php
session_start();
require(“…/tasks/passw.php”);
if(!isset($_SESSION[“id”]))
{
header(“location:…/login.html”);
die();
}
//is expired
if(sexpired())
{
header(“location:logout.php”);
exit();
}
?>
<html lang="en-us">
Expand Down
6 changes: 6 additions & 0 deletions user/setting.php
Expand Up
@@ -8,6 +8,12 @@
exit();
}
//is expired
if(sexpired())
{
header(“location:logout.php”);
exit();
}
if (isset($_POST[“ch-info”])) {
Expand Down
0 comments on commit 99738b2
Please sign in to comment.