CVE-2017-6903: Insufficient Information (NVD-CWE-noinfo)
value: In ioquake3 before 2017-03-14, the auto-downloading feature has insufficient content restrictions. This also affects Quake III Arena, OpenArena, OpenJK, iortcw, and other id Tech 3 (aka Quake 3 engine) forks. A malicious auto-downloaded file can trigger loading of crafted auto-downloaded files as native code DLLs. A malicious auto-downloaded file can contain configuration defaults that override the user's. Executable bytecode in a malicious auto-downloaded file can set configuration variables to values that will result in unwanted native code DLLs being loaded, resulting in sandbox escape.
CWE description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
CVSS v3 base score: 7.8
Published: 2017-03-14T22:59Z
Repository: https://github.com/iortcw/iortcw
Language: C
Files changed: MP/code/client/cl_console.c, MP/code/qcommon/common.c, SP/code/client/cl_console.c, SP/code/qcommon/common.c
Commit date: 2017-03-14 03:26:09 -0400
Commit message: All: Merge some file writing extension checks

Diff: diff --git a/MP/code/client/cl_console.c b/MP/code/client/cl_console.c
index 2df9ad2e..dad42d9e 100644
--- a/MP/code/client/cl_console.c
+++ b/MP/code/client/cl_console.c
@@ -225,10 +225,16 @@ void Con_Dump_f( void ) {
 	}
 
 	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
 	COM_DefaultExtension( filename, sizeof( filename ), ".txt" );
 
+	if (!COM_CompareExtension(filename, ".txt"))
+	{
+		Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
+		return;
+	}
+
 	f = FS_FOpenFileWrite( filename );
 	if ( !f ) {
 		Com_Printf ("ERROR: couldn't open %s.\n", filename);
 		return;
 	}
diff --git a/MP/code/qcommon/common.c b/MP/code/qcommon/common.c
index f0ab138e..13b36fd3 100644
--- a/MP/code/qcommon/common.c
+++ b/MP/code/qcommon/common.c
@@ -3056,10 +3056,16 @@ void Com_WriteConfig_f( void ) {
 	if ( Cmd_Argc() != 2 ) {
 		Com_Printf( "Usage: writeconfig <filename>\n" );
 		return;
 	}
 
+	if (!COM_CompareExtension(filename, ".cfg"))
+	{
+		Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
+		return;
+	}
+
 	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
 	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
 	Com_Printf( "Writing %s.\n", filename );
 	Com_WriteConfigToFile( filename );
 }
diff --git a/SP/code/client/cl_console.c b/SP/code/client/cl_console.c
index 081fe5a4..e7797eae 100644
--- a/SP/code/client/cl_console.c
+++ b/SP/code/client/cl_console.c
@@ -217,10 +217,16 @@ void Con_Dump_f( void ) {
 	}
 
 	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
 	COM_DefaultExtension( filename, sizeof( filename ), ".txt" );
 
+	if (!COM_CompareExtension(filename, ".txt"))
+	{
+		Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
+		return;
+	}
+
 	f = FS_FOpenFileWrite( filename );
 	if ( !f ) {
 		Com_Printf ("ERROR: couldn't open %s.\n", filename);
 		return;
 	}
diff --git a/SP/code/qcommon/common.c b/SP/code/qcommon/common.c
index 9dd71442..402941f3 100644
--- a/SP/code/qcommon/common.c
+++ b/SP/code/qcommon/common.c
@@ -2599,10 +2599,16 @@ void Com_WriteConfig_f( void ) {
 	if ( Cmd_Argc() != 2 ) {
 		Com_Printf( "Usage: writeconfig <filename>\n" );
 		return;
 	}
 
+	if (!COM_CompareExtension(filename, ".cfg"))
+	{
+		Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
+		return;
+	}
+
 	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
 	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
 	Com_Printf( "Writing %s.\n", filename );
 	Com_WriteConfigToFile( filename );
 }

Fixed code: 	if (!COM_CompareExtension(filename, ".txt"))
	{
		Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
		return;
	}

	if (!COM_CompareExtension(filename, ".cfg"))
	{
		Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
		return;
	}

	if (!COM_CompareExtension(filename, ".txt"))
	{
		Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
		return;
	}

	if (!COM_CompareExtension(filename, ".cfg"))
	{
		Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
		return;
	}