AVideo's _session_start() function accepts arbitrary session IDs via the PHPSESSID GET parameter and sets them as the active PHP session. A session regeneration bypass exists for specific blacklisted endpoints when the request originates from the same domain. Combined with the explicitly disabled session regeneration in User::login(), this allows a classic session fixation attack where an attacker can fix a victim's session ID before authentication and then hijack the authenticated session.
The vulnerability is a chain of three weaknesses that together enable session fixation:
objects/functionsPHP.php:344-367)function _session_start(array $options = [])
{
// ...
if (isset($_GET['PHPSESSID']) && !_empty($_GET['PHPSESSID'])) {
$PHPSESSID = $_GET['PHPSESSID'];
// ...
if (!User::isLogged()) {
if ($PHPSESSID !== session_id()) {
_session_write_close();
session_id($PHPSESSID); // <-- sets session to attacker's ID
}
$session = @session_start($options); // <-- starts with attacker's ID
The code reads $_GET['PHPSESSID'] and programmatically calls session_id($PHPSESSID), which bypasses both session.use_only_cookies and session.use_strict_mode PHP settings since the session ID is set via the PHP API, not via cookie/URL handling.
objects/functionsPHP.php:375-378, objects/functions.php:3100-3116)// functionsPHP.php:375-378
if (!blackListRegenerateSession()) {
_session_regenerate_id(); // <-- SKIPPED when blacklisted + same-domain
}
// functions.php:3100-3116
function blackListRegenerateSession()
{
if (!requestComesFromSafePlace()) {
return false;
}
$list = [
'objects/getCaptcha.php',
'objects/userCreate.json.php',
'objects/videoAddViewCount.json.php',
];
foreach ($list as $needle) {
if (str_ends_with($_SERVER['SCRIPT_NAME'], $needle)) {
return true; // <-- regeneration skipped for these endpoints
}
}
return false;
}
The requestComesFromSafePlace() check at objects/functionsSecurity.php:182 only verifies that HTTP_REFERER matches the AVideo domain. When a victim clicks a link from within the AVideo platform (e.g., in a comment or video description), the browser naturally sets the Referer to the AVideo domain, satisfying this check.
objects/user.php:1315-1317)// Call custom session regenerate logic
// this was regenerating the session all the time, making harder to save info in the session
//_session_regenerate_id(); // <-- COMMENTED OUT
The session regeneration after authentication is explicitly disabled. This means the session ID persists unchanged through the login transition, which is the fundamental requirement for session fixation to succeed.
objects/phpsessionid.json.php exposes session IDs to any same-origin JavaScript without authentication (line 12: $obj->phpsessid = session_id())view/js/session.js stores the session ID in a global window.PHPSESSID variable and logs it to console (line 15)# Attacker visits the site to get a valid session ID
curl -v https://target.example.com/ 2>&1 | grep 'set-cookie.*PHPSESSID'
# Response: Set-Cookie: PHPSESSID=attacker_known_session_id; ...
The attacker posts a comment on a video or creates content containing a link:
https://target.example.com/objects/getCaptcha.php?PHPSESSID=attacker_known_session_id
This can be placed in a video comment, video description, user bio, or forum post — anywhere AVideo renders user-provided links.
When the victim clicks the link from within the AVideo platform:
1. Browser sets Referer: https://target.example.com/... (same-domain)
2. _session_start() processes $_GET['PHPSESSID'], victim is not logged in, so session_id('attacker_known_session_id') is called
3. blackListRegenerateSession() returns true (script is getCaptcha.php + same-domain Referer)
4. _session_regenerate_id() is skipped
5. Victim's session is now fixed to attacker_known_session_id
The victim navigates to the login page and authenticates. User::login() populates $_SESSION['user'] but does NOT regenerate the session ID (line 1317 is commented out).
# Attacker uses the known session ID to access victim's account
curl -b "PHPSESSID=attacker_known_session_id" https://target.example.com/objects/user.php?userAPI=1
# Response: victim's user data, confirming session hijack
objects/user.php:1317)// Replace the commented-out line:
//_session_regenerate_id();
// With:
_session_regenerate_id();
This is the most critical fix. Session regeneration on authentication transition is a fundamental defense against session fixation (OWASP recommendation).
objects/functionsPHP.php:344-383)Remove or restrict the $_GET['PHPSESSID'] handling entirely. If it is needed for specific use cases (e.g., CAPTCHA), validate the session ID against a server-side token rather than blindly accepting arbitrary values:
// Instead of accepting any GET PHPSESSID, remove this block entirely.
// If CAPTCHA requires session continuity, pass a CSRF token instead.
if (isset($_GET['PHPSESSID']) && !_empty($_GET['PHPSESSID'])) {
// REMOVED: Do not accept session IDs from URL parameters
}
objects/phpsessionid.json.php, view/js/session.js)The phpsessionid.json.php endpoint and the session.js global variable negate the httponly cookie flag. If JavaScript needs to reference the session for AJAX requests, the browser automatically includes session cookies — there is no need to expose the session ID value to JavaScript.
{
"severity": "HIGH",
"github_reviewed": true,
"nvd_published_at": "2026-03-23T16:16:49Z",
"cwe_ids": [
"CWE-384"
],
"github_reviewed_at": "2026-03-20T20:49:23Z"
}