{"id":"UBUNTU-CVE-2021-41816","details":"CGI.escape_html in Ruby before 2.7.5 and 3.x before 3.0.3 has an integer overflow and resultant buffer overflow via a long string on platforms (such as Windows) where size_t and long have different numbers of bytes. This also affects the CGI gem before 0.3.1 for Ruby.","modified":"2026-04-22T13:01:00.868243Z","published":"2021-12-02T00:00:00Z","related":["USN-5235-1"],"upstream":["CVE-2021-41816"],"references":[{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2021-41816"},{"type":"REPORT","url":"https://www.ruby-lang.org/en/news/2021/11/24/buffer-overrun-in-cgi-escape_html-cve-2021-41816/"},{"type":"REPORT","url":"https://github.com/ruby/cgi/commit/c728632c1c09d46cfd4ecbff9caaa3651dd1002a"},{"type":"ADVISORY","url":"https://ubuntu.com/security/notices/USN-5235-1"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2021-41816"}],"affected":[{"package":{"name":"ruby2.7","ecosystem":"Ubuntu:20.04:LTS","purl":"pkg:deb/ubuntu/ruby2.7@2.7.0-5ubuntu1.6?arch=source&distro=focal"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.7.0-5ubuntu1.6"}]}],"versions":["2.7.0-1","2.7.0-2","2.7.0-3","2.7.0-4","2.7.0-4ubuntu1","2.7.0-5ubuntu1","2.7.0-5ubuntu1.1","2.7.0-5ubuntu1.2","2.7.0-5ubuntu1.3","2.7.0-5ubuntu1.4","2.7.0-5ubuntu1.5"],"ecosystem_specific":{"availability":"No subscription required","binaries":[{"binary_name":"libruby2.7","binary_version":"2.7.0-5ubuntu1.6"},{"binary_name":"ruby2.7","binary_version":"2.7.0-5ubuntu1.6"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-41816.json"}},{"package":{"name":"ruby3.0","ecosystem":"Ubuntu:22.04:LTS","purl":"pkg:deb/ubuntu/ruby3.0@3.0.2-7ubuntu2?arch=source&distro=jammy"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.0.2-7ubuntu2"}]}],"versions":["3.0.2-5ubuntu1","3.0.2-7"],"ecosystem_specific":{"availability":"No subscription required","binaries":[{"binary_version":"3.0.2-7ubuntu2","binary_name":"libruby3.0"},{"binary_name":"ruby3.0","binary_version":"3.0.2-7ubuntu2"}]},"database_specific":{"source":"https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2021/UBUNTU-CVE-2021-41816.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"},{"type":"Ubuntu","score":"medium"}]}