The vulnerability exists in the openclaw package's handling of CDP (Chrome DevTools Protocol) hostnames. Specifically, the code did not account for trailing dots in hostnames when checking for loopback addresses. An attacker could provide a hostname like localhost. which would resolve to localhost but bypass the application's security checks.
The patch in src/gateway/net.ts addresses this by modifying the parseHostForAddressChecks function. The updated code now removes any trailing dots from the hostname before comparing it to 'localhost'. This ensures that variations of 'localhost' are correctly identified as loopback addresses.
The test file extensions/browser/src/browser/cdp.test.ts includes a new test case that confirms the fix, showing that a websocket URL with localhost. is correctly rewritten. This indicates that the normalizeCdpWsUrl function, which likely uses parseHostForAddressChecks, is now secure against this bypass. The core of the vulnerability, however, lies in the parseHostForAddressChecks function's improper input validation.