security: add resource limits to config parser to prevent DoS#1507
security: add resource limits to config parser to prevent DoS#1507ibrahimu8 wants to merge 1 commit intoslackhq:masterfrom
Conversation
|
Thanks for the contribution! Before we can merge this, we need @servis to sign the Salesforce Inc. Contributor License Agreement. |
- Add maxConfigFileSize (5MB) and maxConfigKeys (10000) constants - Check file size before YAML parsing in parse() function - Check key count after unmarshaling in both parse() and parseRaw() - Prevents memory/CPU exhaustion attacks via malicious config files Fixes: Resource exhaustion vulnerability where attackers could crash Nebula by providing extremely large configuration files
781fdec to
71d46c9
Compare
|
Thanks for the patch This doesn't seem like it actually does any prevention other than displaying an errors message instead of continuing. I'd much rather see limits used on the file input read e.g. by wrapping the file reader in a io.LimitedReader, that is, if and only if we agree that this is something we want to address. I can't immediately think of a situation where an untrusted source would create a large configuration file, but maybe I'm not trying hard enough. |
|
Hi @ibrahimu8, thanks for the contribution! Limits are usually a good thing, but in this case I think it's important to point out that if an attacker is able to control the contents of the nebula config file, it's over. DOS would be a kindness compared to what would otherwise be possible. That said, I'm open to merging if you wanted to take the |
Security Fix: Prevent Config Parser Resource Exhaustion
Vulnerability:
Nebula's configuration parser lacked resource limits, allowing attackers to cause Denial of Service through memory/CPU exhaustion via specially crafted large config files.
Impact:
Changes:
Added resource limits:
maxConfigFileSize = 5 * 1024 * 1024(5MB max file size)maxConfigKeys = 10000(max keys per config file)Added validation checks:
parse()parse()andparseRaw()Testing:
Backward Compatibility
Context:
This addresses a resource exhaustion vulnerability where attackers could crash Nebula by providing extremely large configuration files.