Skip to content

A stack buffer overflow issue in wavpack.c #99

@qian-feng

Description

@qian-feng

Summary

A stack-based buffer overflow vulnerability exists in WavPack 5.4.0 and earlier. It is discovered by Baidu Fuzzing platform. This vulnerability allows local or remote attackers to launch a code execution or a denial of service attack.

Vulnerability Description

Wavpack does not check the length of infilename when openning it. If the file does not exist, the size of infilename could exceed 512, which will overflow the error_msg buffer.

WavPack 5.4.0/cli/utils.c:438

void error_line (char *error, ...)
{
    char error_msg [512];
    va_list argptr;
    error_msg [0] = '\r';
    va_start (argptr, error);
    vsprintf (error_msg + 1, error, argptr); \\ **********error_msg of 512 could be overflowed. **********
    va_end (argptr);
    fputs (error_msg, stderr);
    finish_line ();

WavPack 5.4.0/cli/wavpack.c:1546

else if ((infile = fopen (infilename, "rb")) == NULL) {
    error_line ("can't open file %s!", infilename);  \\*******************the length of infilename is not checked***************
    WavpackCloseFile (wpc);
    return WAVPACK_SOFT_ERROR;
}

Steps to reproduce

./wavpack AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions