Skip to content
Info disclosure Disclosed report Intermediate

ARG_CLEAR credential scrubbing wipes only UTF-8 copies on Windows Unicode builds

On Windows Unicode builds, curl's credential scrubbing only overwrites the UTF-8 copy of command-line arguments, leaving the original wide-character command line intact. A local user who can list process command lines could read credentials passed via options such as --user or --proxy-user for the duration of the transfer.

giant_anteater Follow

Originally disclosed on HackerOne

  • Disclosed after 43 hours

cleanarg() operates on char *str, which is the UTF-8 copy allocated by convert_tchar_to_UTF8(). It has no reference to the original wchar_t argv[] element.

C
/* tool_getparam.c:632 */
static void cleanarg(char *str)
{
  /* now that getstr has copied the contents of nextarg, wipe the next
   * argument out so that the username:password is not displayed in the
   * system process list */
  if(str) {
    size_t len = strlen(str);
    memset(str, '*', len);
  }
}

In parse_args() (line 3115), the conversion and scrub flow is:

C
orig_opt = convert_tchar_to_UTF8(argv[i]);      /* UTF-8 copy of the option */
nextarg  = convert_tchar_to_UTF8(argv[i + 1]);  /* UTF-8 copy of the value  */
err = getparameter(orig_opt, nextarg, ...);
/* inside getparameter, line 3090: */
if(a->desc & ARG_CLEAR)
    cleanarg(CURL_UNCONST(nextarg));             /* scrubs the UTF-8 copy    */
unicodefree(CURL_UNCONST(nextarg));              /* frees the UTF-8 copy     */
/* argv[i+1] — the original wchar_t pointer — is never touched */

The original wchar_t argv[i + 1] buffer, which is part of the process command line visible through the PEB, is never overwritten by cleanarg() or any other routine. unicodefree() only frees the converted copy, not the original.

Impact

A co-located process or user with permission to enumerate process command lines can read credentials supplied via --user, --proxy-user, --pass, --oauth2-bearer, --proxy-pass, --tlspassword, --proxy-tlspassword, --cert, --proxy-cert, --httpsig-key, or --tlsuser for the entire duration of the curl transfer. This defeats the explicit security goal of cleanarg(), which curl's own source comments describe as hiding "username:password" from "the system process list."

The attack requires local access (AV:L) with low privilege (PR:L) — any authenticated Windows user can call wmic process get commandline or Get-CimInstance Win32_Process. No user interaction is needed (UI:N) and the impact is high confidentiality loss (C:H) of the exposed credentials.

The original report as published on HackerOne, by giant_anteater. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the scrubbing function only receives the converted UTF-8 copy of the argument and has no reference to the original wide-character command-line buffer, so the original is never overwritten.

Impact

A local low-privileged user could read credentials from the process command line for the duration of the transfer, defeating the intended scrubbing.

What the attacker needed

Local access to the Windows host; ability to list process command lines; curl running with credentials in arguments

The fix

The original wide-character command-line buffer is not overwritten, so scrubbing does not hide credentials there.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you run a program with arguments, the operating system keeps those arguments in memory so other tools can see them. curl tries to hide passwords by replacing them with asterisks, but on Windows it only changes a temporary copy and not the original. So another user on the same machine could still read the password while curl is running.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by giant_anteater

View all

93 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.