The vulnerability lies in the _file_recv method within the salt/master.py file of the SaltStack project. The method is responsible for receiving files and storing them in the master's cache directory.
The original code constructed the destination path (cpath) by joining the base cache directory, minion ID, 'files', and a normalized path derived from user input (load["path"]). The security check involved normalizing cpath and verifying if it started with the configured cache directory path (self.opts["cachedir"]). This check was inadequate because os.path.normpath could be bypassed with certain path traversal sequences (e.g., ../../..), allowing an attacker to write files to arbitrary locations on the master server, limited by the permissions of the Salt master process.
The patch addresses this by first defining a base restricted path (rpath) and then joining the user-provided path (normpath) to it. Crucially, it replaces the weak startswith check with a call to salt.utils.verify.clean_path(rpath, cpath). This function is designed to properly sanitize and validate file paths, ensuring that the final path cpath is confined within the intended rpath directory, thus preventing the directory traversal.
Therefore, the _file_recv function is the direct point of vulnerability as it processes the user-controlled path and performs the file write operation. During exploitation, this function would be in the call stack when the malicious file write occurs.