-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v.2.11.10
Python version
3.8
Steps to Reproduce
- Create a site
- Create export template for sites
- Fill out required fields
- Enter
{{ ''.__class__.__mro__[1].__subclasses__()[199]('id', shell=True,stdout=-1).communicate()}}intemplate code. Indexes for mro and subclasses will probably differ per instance. - Go to sites and execute the export template
- Open generated csv file
Expected Behavior
Error or default csv file generated
Observed Behavior
.csv file contains (b'uid=101 gid=0(root)\n', None)
Suggestions
I see two immediate options.
- Make it clear in the documentation that having rights to create webhooks, export templates or custom links is dangerous and allows RCE on the host.
- Use the jinja2 sandbox: https://jinja.palletsprojects.com/en/3.0.x/sandbox/
With option 2 there should probably still be a note in the documentation, as sandboxes are rarely known to be perfect.
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application