The vulnerability is a denial of service in the rs/cors library, caused by excessive memory allocation when handling preflight requests. The root cause lies in the splitHeaderValues function in utils.go. This function would split the Access-Control-Request-Headers header value by commas. An attacker could craft a request with a header containing thousands of commas, forcing splitHeaderValues to allocate a massive slice of strings, leading to resource exhaustion.
The vulnerable workflow was orchestrated by the handlePreflight function in cors.go. This function would read the header and pass it to splitHeaderValues, and then the resulting slice would be processed by areHeadersAllowed. All three functions are key to triggering the vulnerability.
The patch addresses the issue by completely removing the splitHeaderValues and areHeadersAllowed functions. It introduces a new data structure, SortedSet, and a method, Subsumes, which validates the header by iterating over the raw string in controlled chunks. This avoids the large memory allocation, effectively mitigating the DoS risk. The handlePreflight function was updated to use this new, secure mechanism. Therefore, a runtime profile during exploitation would prominently feature splitHeaderValues as the source of the memory allocation, called from handlePreflight.