GNS3 / gns3-server

GNS3 server
GNU General Public License v3.0
811 stars 263 forks source link

Security: accessing any file on the server - via qemu #1922

Open candlerb opened 3 years ago

candlerb commented 3 years ago

This is probably of academic interest only, but I will point out that anyone with access to the GNS3 web interface or API can access any file readable to the gns3 user on the host system via qemu (not in the same way as #1894). Here's how:

You have just read the file /etc/sysctl.conf from the host.

Implications (today)

Unrestricted access to qemu lets it be used as a proxy to the filesystem.

It might be possible to sanitise the qemu "additional settings", either within GNS3 itself, or in a wrapper which calls qemu. However I don't want to see "additional settings" disabled entirely; I find it far too useful (e.g. to set -cpu Skylake-Client, which is benign). An option in gns3.conf to give a validation regexp for qemu additional settings could be a good idea, but there might be other ways to abuse qemu that I haven't thought of, so it might not actually gain any security.

Implications (future ideas)

grossmj commented 3 years ago

Thanks for bridging this to our attention, definitely something we should try to mitigate as much as we can :+1:

candlerb commented 3 years ago

In https://github.com/GNS3/gns3-server/issues/1921#issuecomment-867435063 you said:

Regarding getting images via our API, this won't be possible in the future thanks to our new RBAC implementation in version 3.0.

I think that RBAC could help a lot with this issue too. For example, normal users (students) could be restricted to using pre-defined appliances; only superusers could change the qemu settings on a node. This could also avoid some DoS attacks, such as creating qemu nodes that use vast amounts of RAM.