Skip to content

Commit 4148670

Browse files
Use absolute /usr/bin/tar to avoid PATH hijack
Call /usr/bin/tar instead of plain "tar" when extracting JDK archives in JdkInstaller to avoid PATH-based hijacking. Adds a comment documenting the change; other ProcessStartInfo settings remain unchanged.
1 parent 18d17d5 commit 4148670

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Xamarin.Android.Tools.AndroidSdk/JdkInstaller.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,9 @@ async Task ExtractTarGzAsync (string archivePath, string destinationPath, Cancel
461461
var escapedArchivePath = archivePath.Replace ("'", "'\\''");
462462
var escapedDestinationPath = destinationPath.Replace ("'", "'\\''");
463463

464+
// Use an absolute path to avoid PATH-based hijacking
464465
var psi = new ProcessStartInfo {
465-
FileName = "tar",
466+
FileName = "/usr/bin/tar",
466467
Arguments = $"-xzf '{escapedArchivePath}' -C '{escapedDestinationPath}'",
467468
UseShellExecute = false,
468469
CreateNoWindow = true,

0 commit comments

Comments
 (0)