diff --git a/.github/workflows/shared_meterpreter_acceptance.yml b/.github/workflows/shared_meterpreter_acceptance.yml index 956d5fd4b0728..7e19d7e766c04 100644 --- a/.github/workflows/shared_meterpreter_acceptance.yml +++ b/.github/workflows/shared_meterpreter_acceptance.yml @@ -42,9 +42,9 @@ jobs: - name: Checkout metasploit-payloads uses: actions/checkout@v4 with: - repository: rapid7/metasploit-payloads + repository: zeroSteiner/metasploit-payloads path: metasploit-payloads - ref: ${{ inputs.metasploit_payloads_commit }} + ref: fix/met/php-udp-sockets-2 - name: Build Meterpreter payloads run: | @@ -112,11 +112,12 @@ jobs: if: runner.os == 'Linux' run: sudo apt-get -y --no-install-recommends install libpcap-dev graphviz - - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 + - uses: shivammathur/setup-php@verbose if: ${{ matrix.meterpreter.name == 'php' }} with: php-version: ${{ matrix.meterpreter.runtime_version }} tools: none + extensions: sockets - name: Set up Python if: ${{ matrix.meterpreter.name == 'python' }} @@ -137,7 +138,7 @@ jobs: REM pcap dependencies powershell -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip', 'C:\Windows\Temp\WpdPack_4_1_2.zip')" - choco install 7zip.installServerCertificateValidationCallback + choco install 7zip.install 7z x "C:\Windows\Temp\WpdPack_4_1_2.zip" -o"C:\" dir C:\\ @@ -255,9 +256,9 @@ jobs: if: ${{ inputs.build_metasploit_payloads && matrix.meterpreter.name != 'mettle' }} uses: actions/checkout@v4 with: - repository: rapid7/metasploit-payloads + repository: zeroSteiner/metasploit-payloads path: metasploit-payloads - ref: ${{ inputs.metasploit_payloads_commit }} + ref: fix/met/php-udp-sockets-2 - name: Build Windows payloads via Visual Studio 2019 Build (Windows) shell: cmd @@ -272,23 +273,50 @@ jobs: shell: pwsh if: ${{ matrix.meterpreter.name == 'windows_meterpreter' && matrix.os == 'windows-2022' && inputs.build_metasploit_payloads }} run: | + $vsInstallerDir='C:\Program Files (x86)\Microsoft Visual Studio\Installer' + Write-Host "Listing $vsInstallerDir" + Get-ChildItem -Force $vsInstallerDir | ForEach-Object { Write-Host $_.Name } + Write-Host "vs_installer exists: $(Test-Path (Join-Path $vsInstallerDir 'vs_installer.exe'))" + Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" dir - $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" - $WorkLoads = '--config "D:\a\metasploit-payloads\metasploit-payloads\metasploit-payloads\c\meterpreter\vs-configs\vs2022.vsconfig"' - $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache') - $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden - if ($process.ExitCode -eq 0) { - Write-Host "components have been successfully added" + $installer = 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe' + $installPath = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' + $vsconfig = Join-Path $env:GITHUB_WORKSPACE 'metasploit-payloads\c\meterpreter\vs-configs\vs2022.vsconfig' + Write-Host "Checking vsconfig path: $vsconfig" + + # show current workspace and mapping info + Write-Host "GITHUB_WORKSPACE: $env:GITHUB_WORKSPACE" + Write-Host "PWD:" + Get-Location + + # quick exists check + if (Test-Path -LiteralPath $vsconfig) { + Write-Host "vsconfig FOUND at: $vsconfig" } else { - Write-Host "components were not installed" + Write-Host "vsconfig NOT FOUND at: $vsconfig" exit 1 } - Set-Location "D:\a\metasploit-payloads\metasploit-payloads\metasploit-payloads\c\meterpreter" - $r = Invoke-Command -ScriptBlock { cmd.exe /c 'git submodule init && git submodule update' } - Write-Host $r - $r = Invoke-Command -ScriptBlock { cmd.exe /c '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && make.bat' } - Write-Host $r + + # Show vsconfig contents for debugging + Write-Host "`n---- vsconfig contents ----" + Get-Content $vsconfig | ForEach-Object { Write-Host $_ } + Write-Host "---- end vsconfig ----`n" + + $stdoutFile = Join-Path $env:RUNNER_TEMP 'vs_modify_stdout.txt' + $stderrFile = Join-Path $env:RUNNER_TEMP 'vs_modify_stderr.txt' + + Write-Host "Running installer with redirected output..." + # Removed --quiet flag to get more verbose output + $argList = @('modify', '--installPath', $installPath, '--config', $vsconfig, '--norestart', '--nocache') + $proc = Start-Process -FilePath $installer -ArgumentList $argList -Wait -PassThru -NoNewWindow + + Write-Host "Installer exit code: $($proc.ExitCode)" + if ($proc.ExitCode -ne 0) { + Write-Host "components were not installed (exit code $($proc.ExitCode)). See logs above." + exit $proc.ExitCode + } + Write-Host "components have been successfully added" working-directory: metasploit-payloads - name: Build Windows payloads via Visual Studio 2025 Build (Windows) diff --git a/Gemfile.lock b/Gemfile.lock index da2ab98c10a39..c2d36b1dd6752 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -46,7 +46,7 @@ PATH metasploit-concern metasploit-credential metasploit-model - metasploit-payloads (= 2.0.237) + metasploit-payloads (= 2.0.238) metasploit_data_models (>= 6.0.7) metasploit_payloads-mettle (= 1.0.45) mqtt @@ -352,7 +352,7 @@ GEM drb mutex_m railties (~> 7.0) - metasploit-payloads (2.0.237) + metasploit-payloads (2.0.238) metasploit_data_models (6.0.9) activerecord (~> 7.0) activesupport (~> 7.0) diff --git a/LICENSE_GEMS b/LICENSE_GEMS index 8c906a9452365..b3239bce497d0 100644 --- a/LICENSE_GEMS +++ b/LICENSE_GEMS @@ -99,7 +99,7 @@ metasploit-concern, 5.0.5, "New BSD" metasploit-credential, 6.0.19, "New BSD" metasploit-framework, 6.4.101, "New BSD" metasploit-model, 5.0.4, "New BSD" -metasploit-payloads, 2.0.237, "3-clause (or ""modified"") BSD" +metasploit-payloads, 2.0.238, "3-clause (or ""modified"") BSD" metasploit_data_models, 6.0.9, "New BSD" metasploit_payloads-mettle, 1.0.45, "3-clause (or ""modified"") BSD" method_source, 1.1.0, MIT diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec index d4e9c79feebf9..dd86fdd11f55e 100644 --- a/metasploit-framework.gemspec +++ b/metasploit-framework.gemspec @@ -74,7 +74,7 @@ Gem::Specification.new do |spec| # are needed when there's no database spec.add_runtime_dependency 'metasploit-model' # Needed for Meterpreter - spec.add_runtime_dependency 'metasploit-payloads', '2.0.237' + spec.add_runtime_dependency 'metasploit-payloads', '2.0.238' # Needed for the next-generation POSIX Meterpreter spec.add_runtime_dependency 'metasploit_payloads-mettle', '1.0.45' # Needed by msfgui and other rpc components