{"id":30764,"date":"2025-12-12T11:58:15","date_gmt":"2025-12-12T11:58:15","guid":{"rendered":"http:\/\/localhost\/?p=30764"},"modified":"2025-12-12T11:58:15","modified_gmt":"2025-12-12T11:58:15","slug":"curl-buffer-overflow-in-curl-internal-printf-function","status":"publish","type":"post","link":"https:\/\/zero.redgem.net\/?p=30764","title":{"rendered":"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525"},"content":{"rendered":"<p>{&#8220;lastseen&#8221;:&#8221;2025-12-12T07:25:46&#8243;,&#8221;description&#8221;:&#8221;A critical buffer overflow vulnerability exists in the `curl_msprintf()` function in cURL&#8217;s internal printf implementation. The function writes formatted output to a user-provided buffer without performing any bounds checking, allowing attackers to overflow arbitrary memory and potentially achieve arbitrary code execution.\\n\\n## Affected Version\\nCurrent master branch (commit 141ce4be64) and potentially earlier versions\\n\\n## CVSS Score Breakdown\\n\\n**Base Score: 9.8 (Critical)**\\n- **Attack Vector (AV):** Network (N)\\n- **Attack Complexity (AC):** Low (L)\\n- **Privileges Required (PR):** None (N)\\n- **User Interaction (UI):** None (N)\\n- **Scope (S):** Unchanged (U)\\n- **Confidentiality (C):** High (H)\\n- **Integrity (I):** High (H)\\n- **Availability (A):** High (H)\\n\\n## Vulnerability Details\\n\\n### Location\\n- **File:** `lib\/mprintf.c`\\n- **Function:** `curl_msprintf()`\\n- **Lines:** 1203-1211\\n\\n### Root Cause\\nThe vulnerability occurs because `curl_msprintf()` calls `formatf()` with the `storebuffer()` callback function, which writes directly to the provided buffer without any size validation:\\n\\n&#8220;`c\\nint curl_msprintf(char *buffer, const char *format, &#8230;)\\n{\\n  va_list ap_save; \/* argument pointer *\/\\n  int retcode;\\n  va_start(ap_save, format);\\n  retcode = formatf(\\u0026buffer, storebuffer, format, ap_save);\\n  va_end(ap_save);\\n  *buffer = 0; \/* we terminate this with a zero byte *\/\\n  return retcode;\\n}\\n\\nstatic int storebuffer(unsigned char outc, void *f)\\n{\\n  char **buffer = f;\\n  **buffer = (char)outc;  \/\/ VULNERABILITY: No bounds checking\\n  (*buffer)++;\\n  return 0;\\n}\\n&#8220;`\\n\\n### Attack Vector\\nAn attacker can trigger this vulnerability by:\\n1. Providing a malicious format string to any cURL function that internally uses `curl_msprintf()`\\n2. Supplying format specifiers that generate output larger than the target buffer\\n3. Causing stack corruption and potentially hijacking control flow\\n\\n## Proof of Concept\\n\\n### Test Code\\n&#8220;`python\\nimport ctypes\\n\\n# Load libcurl\\nlibcurl = ctypes.CDLL(\\&#8221;libcurl.so.4\\&#8221;)\\ncurl_msprintf = libcurl.curl_msprintf\\n\\n# Create small buffer (16 bytes)\\nbuffer = ctypes.create_string_buffer(16)\\n\\n# Trigger overflow with long format string\\nlong_format = b\\&#8221;A\\&#8221; * 100 + b\\&#8221;%s\\&#8221; + b\\&#8221;B\\&#8221; * 50\\nresult = curl_msprintf(buffer, long_format)\\n\\nprint(f\\&#8221;Result: {result}\\&#8221;)\\nprint(f\\&#8221;Buffer content: {buffer.value}\\&#8221;)\\n# Buffer overflow occurs &#8211; writes beyond 16-byte buffer\\n&#8220;`\\n\\n## Impact\\n\\n### Business Impact\\n- **Confidentiality:** Critical &#8211; Potential memory disclosure\\n- **Integrity:** Critical &#8211; Arbitrary code execution\\n- **Availability:** High &#8211; Application crashes and DoS\\n\\n### Technical Impact\\n- **Arbitrary Code Execution:** Attackers can execute arbitrary code in the context of the application\\n- **Memory Corruption:** Stack and heap corruption leading to crashes\\n- **Information Disclosure:** Potential leakage of sensitive memory contents\\n- **Denial of Service:** Application crashes and system instability\\n\\n## Affected Components\\n\\n### Primary Functions\\n- `curl_msprintf()` &#8211; Direct vulnerability\\n- Any function calling `curl_msprintf()` internally\\n\\n### Potentially Affected Areas\\n- URL parsing and construction\\n- Error message formatting\\n- Log message generation\\n- HTTP header processing\\n- Cookie handling&#8221;,&#8221;published&#8221;:&#8221;2025-12-12T04:24:36&#8243;,&#8221;modified&#8221;:&#8221;2025-12-12T07:20:25&#8243;,&#8221;type&#8221;:&#8221;hackerone&#8221;,&#8221;title&#8221;:&#8221;curl: Buffer Overflow in cURL Internal printf Function&#8221;,&#8221;source&#8221;:&#8221;&#8221;,&#8221;references&#8221;:&#8221;&#8221;,&#8221;id&#8221;:&#8221;H1:3462525&#8243;,&#8221;bulletinFamily&#8221;:&#8221;bugbounty&#8221;,&#8221;cwe&#8221;:null,&#8221;cvelist&#8221;:[],&#8221;sourceData&#8221;:&#8221;&#8221;,&#8221;sourceHref&#8221;:&#8221;&#8221;,&#8221;cvss&#8221;:{&#8220;score&#8221;:0,&#8221;severity&#8221;:&#8221;NONE&#8221;,&#8221;vector&#8221;:&#8221;NONE&#8221;,&#8221;version&#8221;:&#8221;NONE&#8221;},&#8221;cvss2&#8243;:{},&#8221;cvss3&#8243;:{&#8220;version&#8221;:&#8221;&#8221;,&#8221;vectorString&#8221;:&#8221;&#8221;,&#8221;baseScore&#8221;:0,&#8221;baseSeverity&#8221;:&#8221;&#8221;,&#8221;attackVector&#8221;:&#8221;&#8221;,&#8221;attackComplexity&#8221;:&#8221;&#8221;,&#8221;privilegesRequired&#8221;:&#8221;&#8221;,&#8221;userInteraction&#8221;:&#8221;&#8221;,&#8221;scope&#8221;:&#8221;&#8221;,&#8221;confidentialityImpact&#8221;:&#8221;&#8221;,&#8221;integrityImpact&#8221;:&#8221;&#8221;,&#8221;availabilityImpact&#8221;:&#8221;&#8221;,&#8221;cvssV3&#8243;:{&#8220;version&#8221;:&#8221;&#8221;,&#8221;vectorString&#8221;:&#8221;&#8221;,&#8221;baseScore&#8221;:0,&#8221;baseSeverity&#8221;:&#8221;&#8221;,&#8221;attackVector&#8221;:&#8221;&#8221;,&#8221;attackComplexity&#8221;:&#8221;&#8221;,&#8221;privilegesRequired&#8221;:&#8221;&#8221;,&#8221;userInteraction&#8221;:&#8221;&#8221;,&#8221;scope&#8221;:&#8221;&#8221;,&#8221;confidentialityImpact&#8221;:&#8221;&#8221;,&#8221;integrityImpact&#8221;:&#8221;&#8221;,&#8221;availabilityImpact&#8221;:&#8221;&#8221;}},&#8221;href&#8221;:&#8221;https:\/\/hackerone.com\/reports\/3462525&#8243;,&#8221;category_name&#8221;:&#8221;News&#8221;,&#8221;post_link&#8221;:&#8221;&#8221;,&#8221;product&#8221;:&#8221;&#8221;,&#8221;version&#8221;:&#8221;&#8221;,&#8221;vendor&#8221;:&#8221;&#8221;,&#8221;ai_description&#8221;:&#8221;&#8221;,&#8221;ai_severity&#8221;:&#8221;&#8221;,&#8221;ai_vendor&#8221;:&#8221;&#8221;,&#8221;ai_product&#8221;:&#8221;&#8221;,&#8221;ai_version&#8221;:&#8221;&#8221;,&#8221;ai_score&#8221;:0}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>{&#8220;lastseen&#8221;:&#8221;2025-12-12T07:25:46&#8243;,&#8221;description&#8221;:&#8221;A critical buffer overflow vulnerability exists in the `curl_msprintf()` function in cURL&#8217;s internal printf implementation. The function writes formatted output to a user-provided buffer without&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[6,8,12,117,13,33,7,11,5],"class_list":["post-30764","post","type-post","status-publish","format-standard","hentry","category-category_news","tag-cve","tag-cvss","tag-exploit","tag-hackerone","tag-news","tag-none","tag-security","tag-tapic","tag-vulnerability"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>curl: Buffer Overflow in cURL Internal printf Function_H1:3462525 - zero redgem<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/zero.redgem.net\/?p=30764\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525 - zero redgem\" \/>\n<meta property=\"og:description\" content=\"{&#8220;lastseen&#8221;:&#8221;2025-12-12T07:25:46&#8243;,&#8221;description&#8221;:&#8221;A critical buffer overflow vulnerability exists in the `curl_msprintf()` function in cURL&#8217;s internal printf implementation. The function writes formatted output to a user-provided buffer without...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/zero.redgem.net\/?p=30764\" \/>\n<meta property=\"og:site_name\" content=\"zero redgem\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-12T11:58:15+00:00\" \/>\n<meta name=\"author\" content=\"invoker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"invoker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764\"},\"author\":{\"name\":\"invoker\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/person\\\/fbfeae8dfad117ac08a7621bee1a1dca\"},\"headline\":\"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525\",\"datePublished\":\"2025-12-12T11:58:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764\"},\"wordCount\":595,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\"},\"keywords\":[\"CVE\",\"CVSS\",\"exploit\",\"hackerone\",\"news\",\"NONE\",\"Security\",\"tapic\",\"Vulnerability\"],\"articleSection\":[\"category_news\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/zero.redgem.net\\\/?p=30764#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764\",\"name\":\"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525 - zero redgem\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#website\"},\"datePublished\":\"2025-12-12T11:58:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/zero.redgem.net\\\/?p=30764\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=30764#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/zero.redgem.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#website\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/\",\"name\":\"zero redgem\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/zero.redgem.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\",\"name\":\"zero redgem\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\",\"contentUrl\":\"\",\"width\":191,\"height\":188,\"caption\":\"zero redgem\"},\"image\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/person\\\/fbfeae8dfad117ac08a7621bee1a1dca\",\"name\":\"invoker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"caption\":\"invoker\"},\"sameAs\":[\"https:\\\/\\\/zero.redgem.net\"],\"url\":\"https:\\\/\\\/zero.redgem.net\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525 - zero redgem","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zero.redgem.net\/?p=30764","og_locale":"en_US","og_type":"article","og_title":"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525 - zero redgem","og_description":"{&#8220;lastseen&#8221;:&#8221;2025-12-12T07:25:46&#8243;,&#8221;description&#8221;:&#8221;A critical buffer overflow vulnerability exists in the `curl_msprintf()` function in cURL&#8217;s internal printf implementation. The function writes formatted output to a user-provided buffer without...","og_url":"https:\/\/zero.redgem.net\/?p=30764","og_site_name":"zero redgem","article_published_time":"2025-12-12T11:58:15+00:00","author":"invoker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"invoker","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/zero.redgem.net\/?p=30764#article","isPartOf":{"@id":"https:\/\/zero.redgem.net\/?p=30764"},"author":{"name":"invoker","@id":"https:\/\/zero.redgem.net\/#\/schema\/person\/fbfeae8dfad117ac08a7621bee1a1dca"},"headline":"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525","datePublished":"2025-12-12T11:58:15+00:00","mainEntityOfPage":{"@id":"https:\/\/zero.redgem.net\/?p=30764"},"wordCount":595,"commentCount":0,"publisher":{"@id":"https:\/\/zero.redgem.net\/#organization"},"keywords":["CVE","CVSS","exploit","hackerone","news","NONE","Security","tapic","Vulnerability"],"articleSection":["category_news"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/zero.redgem.net\/?p=30764#respond"]}]},{"@type":"WebPage","@id":"https:\/\/zero.redgem.net\/?p=30764","url":"https:\/\/zero.redgem.net\/?p=30764","name":"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525 - zero redgem","isPartOf":{"@id":"https:\/\/zero.redgem.net\/#website"},"datePublished":"2025-12-12T11:58:15+00:00","breadcrumb":{"@id":"https:\/\/zero.redgem.net\/?p=30764#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zero.redgem.net\/?p=30764"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/zero.redgem.net\/?p=30764#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zero.redgem.net\/"},{"@type":"ListItem","position":2,"name":"curl: Buffer Overflow in cURL Internal printf Function_H1:3462525"}]},{"@type":"WebSite","@id":"https:\/\/zero.redgem.net\/#website","url":"https:\/\/zero.redgem.net\/","name":"zero redgem","description":"","publisher":{"@id":"https:\/\/zero.redgem.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zero.redgem.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/zero.redgem.net\/#organization","name":"zero redgem","url":"https:\/\/zero.redgem.net\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zero.redgem.net\/#\/schema\/logo\/image\/","url":"","contentUrl":"","width":191,"height":188,"caption":"zero redgem"},"image":{"@id":"https:\/\/zero.redgem.net\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/zero.redgem.net\/#\/schema\/person\/fbfeae8dfad117ac08a7621bee1a1dca","name":"invoker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","caption":"invoker"},"sameAs":["https:\/\/zero.redgem.net"],"url":"https:\/\/zero.redgem.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts\/30764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30764"}],"version-history":[{"count":0,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts\/30764\/revisions"}],"wp:attachment":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=30764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=30764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}