Skip to content
Path traversal Write-up Intermediate

Coppermine Photo Gallery <= 1.4.18 Local File Inclusion Vulnerability

The user_get_profile function in Coppermine Photo Gallery 1.4.18 and earlier fails to properly sanitise the lang parameter inside serialised data in the _data cookie when the charset is utf-8. A remote attacker can use directory traversal to include and execute arbitrary local files on the server.

karmainsecurity.com

Published on karmainsecurity.com

Directory traversal vulnerability in the usergetprofile function in include/functions.inc.php in Coppermine Photo Gallery (CPG) 1.4.18 and earlier, when the charset is utf-8, allows remote attackers to include and execute arbitrary local files via a .. (dot dot) in the lang part of serialized data in an data cookie.

The author, on karmainsecurity.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the user_get_profile function passes the lang value from the _data cookie into a file include without validating or restricting the path, allowing directory traversal.

Impact

An attacker could include and execute arbitrary local files on the server, which may lead to code execution depending on what files are present.

What the attacker needed

Charset set to utf-8; attacker can send a crafted _data cookie

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is a local file inclusion bug. The gallery software reads a setting called 'lang' from a cookie, which is a small piece of data a website stores in your browser. Because the software does not check that value properly, an attacker can put a path like '../' in it to make the server load a file from elsewhere on the same machine, and if that file contains code, the server may run it.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.