Resource leak with HTTPBadRequest in StaticLargeObject.get_slo_segments
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
Undecided
|
Unassigned | ||
OpenStack Security Advisory |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
[Sébastien Mériot with OVH sent the following via encrypted E-mail]
Hello guys,
We reach out to you to follow the responsible disclosure process after our team
that works on OpenStack found a security issue that could cause a Deny of
Service. Indeed a resource is not properly free in Swift and in a specific
condition, it leads Swift to leak memory and not properly close file
descriptors. By repeating the exploit, a remote attacker can cause the host to
run out of memory and most likely run out of file descriptors.
The issue occurs when dealing with Static Large Objects (SLO) on EC storage
policy. To reproduce the issue:
1. Create a container with an EC storage policy (PCA at OVHcloud)
$ swift post mycontainer2 --header X-Storage-
2. Put a simple object (without SLO) in the container.
$ swift upload mycontainer2 bigfile --object-name test
3. Delete in loop the object *with* the SLO mode.
$ for i in {1..10000}
do curl -i "http://
done
4. An 400 error is raised : "Not an SLO manifest" and memory is getting leaked.
After investigating the issue the team discovered that a resource was not
properly released :
https:/
Indeed, the body of the resp object is not read and then remain open even after
raising the exception, which cause the memory leak.
Our team suggests to add a `drain_and_close` call before raising the exception
in order to fix the issue:
```python
if resp.is_success:
if config_
else:
# Drain an close requests opened to object servers
```
The issue has been successfully triggered on Swift 2.25 and 2.29. And it seems
the upstream still is vulnerable as shown above.
This vulnerability could be rated 7.5 according to CVSS3 calculator:
CVSS:3.
Feel free to contact us if you need any additionnal information.
Regards,
Sébastien Mériot
Head of CSIRT-OVH
PGP: https:/
OVHcloud | Roubaix, FR
Since this report concerns a possible security risk, an incomplete
security advisory task has been added while the core security
reviewers for the affected project or projects confirm the bug and
discuss the scope of any vulnerability along with potential
solutions.