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

potential for priv esc #2

Open
BenGardiner opened this issue Jun 24, 2018 · 5 comments
Open

potential for priv esc #2

BenGardiner opened this issue Jun 24, 2018 · 5 comments
Assignees
Labels
Milestone

Comments

@BenGardiner
Copy link
Member

https://github.com/reap3r/firewall/blob/master/appliance/app/rules_scheduler.py#L8

This is a TODO for us (I'll take the TODO for now). The ufw rules sched is running as root and reading/parsing data set by the lower priv service. The following question needs to be answered in affirmative to have confidence in this: does ufw.run protect against command injection?

@BenGardiner BenGardiner self-assigned this Jun 24, 2018
@callrbx
Copy link

callrbx commented Jul 23, 2018

Technically, no. If malicious commands somehow ended up in the rules DB I believe they would be executed as root. This is a huge issue, and I am tracking it.

However, the IP filtering currently only allows valid IP addresses to be given. We probably need to add a filter in the rules scheduler itself, or do a deeper dive into ufw.run

@callrbx callrbx closed this as completed Jul 23, 2018
@BenGardiner
Copy link
Member Author

Ok. Where are you tracking the separate issue of potential exec as root?

@BenGardiner
Copy link
Member Author

ping. is there a filter in the rules scheduler now? are there any guards against command injection in ufw.run ?

you mentioned you were tracking this issue; do you have some notes on the design that mitigate this risk?

@BenGardiner BenGardiner reopened this Nov 8, 2018
@callrbx
Copy link

callrbx commented Nov 12, 2018

The UFW parser should filter any malicious commands that are manually placed in the DB.
The REST API only accepts valid IP/GEO addresses.

@callrbx callrbx closed this as completed Nov 12, 2018
@BenGardiner
Copy link
Member Author

https://github.com/reap3r/nmfta-bouncer/blob/master/appliance/src/rules_scheduler.py#L8

I think there should be more segmentation of privilege here. I'm leary that ufw.frontend.parse_command is impervious to command-injection. i.e. we should mitigate the risk that an attacked who compromises the web front-end and uses it privilege to write to the database to run commands as root.

There might be a way to make the scheduler run as root with dropped privileges so that it can only run ufw, but doing this is non-obvious. I think the biggest bang for the buck here is to require that the ufw scheduler runs in a non-privileged user who has sudo rights only for /usr/sbin/ufw

cc @krishnaswin

@BenGardiner BenGardiner reopened this Jan 16, 2019
@BenGardiner BenGardiner removed their assignment Apr 29, 2019
@BenGardiner BenGardiner added this to the next milestone May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants