Update PHP Meterpreter errors#802
Merged
Merged
Conversation
cf992a7 to
600fb24
Compare
There was a problem hiding this comment.
Pull request overview
Updates the PHP Meterpreter implementation to improve channel/socket close handling (to address acceptance-test failures), makes process enumeration more portable across ps variants, and adjusts the CI reusable-workflow invocation to test PR heads.
Changes:
- Adjusts dead-channel notification to write back on the active transport socket instead of relying on a global C2 socket.
- Updates
read()to treat empty reads as peer-closed (EOF) for both sockets and streams. - Makes
stdapi_sys_process_get_processespsinvocation portable and updates the GitHub Actions workflow to use a versioned reusable workflow and pass PR head repo/commit.
Impact Analysis:
- Blast radius: Medium—affects PHP Meterpreter core I/O and channel lifecycle behavior (all PHP sessions using TCP transport; HTTP behavior is potentially impacted where
_socketis absent). - Data and contract effects: No schema changes, but changes the conditions under which EOF is surfaced as
falseand when channel-close TLVs are emitted; may affect interoperability with Metasploit channel semantics on disconnect paths. - Rollback and test focus: Low rollback friction (single-file logic changes), but validate: TCP client/server close propagation, partial-packet reads, and any scenarios where the current transport is HTTP (no
_socket) while channels are active.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
php/meterpreter/meterpreter.php |
Refactors dead-channel handling to use an explicit C2 socket and tightens EOF detection in socket/stream reads. |
php/meterpreter/ext_server_stdapi.php |
Updates ps output formatting to suppress headers portably and use POSIX command. |
.github/workflows/metasploit-framework-meterpreter_acceptance.yml |
Pins reusable workflow version and passes payloads repo/commit for PR head testing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
190183b to
77848bb
Compare
adfoster-r7
commented
Jul 8, 2026
| # Use empty column-name syntax (pid=,user=,command=) to suppress the | ||
| # header portably on both Linux procps-ng and macOS/BSD ps. | ||
| # 'command' is the POSIX name; Linux also accepts 'cmd' but macOS does not. | ||
| $output = my_cmd("ps ax -w -o pid=,user=,command= 2>/dev/null"); |
Contributor
Author
There was a problem hiding this comment.
old on OSX:
$ ps ax -w -o pid,user,cmd --no-header
ps: cmd: keyword not found
ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-u]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
new on OSX:
$ ps ax -w -o pid=,user=,command=
1 root /sbin/launchd
120 root /usr/libexec/logd
121 root /usr/libexec/smd
Contributor
Author
There was a problem hiding this comment.
Looks like this didn't support freebsd still, updated
77848bb to
c1ee38d
Compare
c1ee38d to
d7211e0
Compare
d7211e0 to
8c23409
Compare
smcintyre-r7
pushed a commit
that referenced
this pull request
Jul 8, 2026
Update PHP Meterpreter errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update PHP Meterpreter to resolve the following errors:
Testing
Before 🔴
PHP test errors
After 🟢
It's gone green on CI here: