mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 14:45:14 +00:00 
			
		
		
		
	[core] Prevent RCE when using --exec with %q (CVE-2024-22423)
				
					
				
			The shell escape function now properly escapes `%`, `\\` and `\n`. `utils.Popen` as well as `%q` output template expansion have been patched accordingly. Prior to this fix using `--exec` together with `%q` when on Windows could cause remote code to execute. See https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-hjq6-52gw-2g7p for more details. Authored by: Grub4K
This commit is contained in:
		| @@ -2069,6 +2069,10 @@ Line 1 | ||||
| 
 | ||||
|         # Test escaping | ||||
|         assert run_shell(['echo', 'test"&']) == '"test""&"\n' | ||||
|         assert run_shell(['echo', '%CMDCMDLINE:~-1%&']) == '"%CMDCMDLINE:~-1%&"\n' | ||||
|         assert run_shell(['echo', 'a\nb']) == '"a"\n"b"\n' | ||||
|         assert run_shell(['echo', '"']) == '""""\n' | ||||
|         assert run_shell(['echo', '\\']) == '\\\n' | ||||
|         # Test if delayed expansion is disabled | ||||
|         assert run_shell(['echo', '^!']) == '"^!"\n' | ||||
|         assert run_shell('echo "^!"') == '"^!"\n' | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Simon Sawicki
					Simon Sawicki