Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 813cbff8b74759f2915b15e01bcfd2b4f3eb6f95a84d715105783bf753d524e0
Ticket: bad6cc213dfe8280c25b3bfe3e5830e9e2481f91
A format string vulnerability in Tcl nmakehelp.c allows code execution via a crated file.
User & Date: salmonx on 2021-06-22 07:33:42
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/html"
  4. comment changed to:
    <p>Description: The 'printf' in 'SubstituteFile' accepts a format string as an argument, but the format string originates from the argv[3] which is controlled by user.
    </p>
    <p>Fix: printf("%s", szBuffer);</p>
    
    <hr>
    <pre>
    static int
    SubstituteFile(
        const char *substitutions,
        const char *filename)
    {
        ...
    
    	/*
    	 * Run the substitutions over each line of the input
    	 */
    
    	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
    	    list_item_t *p = NULL;
    	    for (p = substPtr; p != NULL; p = p->nextPtr) {
    		char *m = strstr(szBuffer, p->key);
    		if (m) {
    		    char *cp, *op, *sp;
    		    cp = szCopy;
    		    op = szBuffer;
    		    while (op != m) *cp++ = *op++;
    		    sp = p->value;
    		    while (sp && *sp) *cp++ = *sp++;
    		    op += strlen(p->key);
    		    while (*op) *cp++ = *op++;
    		    *cp = 0;
    		    memcpy(szBuffer, szCopy, sizeof(szCopy));
    		}
    	    }
    	    printf(szBuffer); // Bug is here, szBuffer can be controlled
    	}
    
    	list_free(&substPtr);
        }
        fclose(fp);
        return 0;
    }
    </pre>
    
  5. foundin changed to: "ALL"
  6. is_private changed to: "0"
  7. login: "salmonx"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "1e6726276a059d4157d886e633147205cbd8e399"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "salmonx"
  14. subsystem changed to: "69. Other"
  15. title changed to:
    A format string vulnerability in Tcl nmakehelp.c allows code execution via a crated file.
    
  16. type changed to: "Bug"