You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A few days ago I was playing around with using Apache2 as a C2-proxy between PoshC2 and active implants. After configuring Apache2 rewrite rules (used the rules from the PoshC2 project directory) I noticed right away that only HTTP GET-requests were coming through to PoshC2. mod_rerwite seemed only to be working specifically for GET-requests; I verified this by taking packet captures between the C2 - C2-proxy and C2-proxy-implant. Furthermore, the documentation of mod_rewrite and some posts on mod_rewrite in combination with POST-requests seem to support this conclusion[1,2,3].
First of all, I apologize if I overlooked a configuration option which would make the Apache2 C2-proxy setup work with rewriting POST-request. If this is the case, you could just dismiss this feature request.
Describe the solution you'd like
The solution I propose is to modify PoshC2 in order that during project generation (and first startup of the C2-server) a HAProxy configuration template is generated; the same way this is currently done for Apache2 rewrite rules. The nice thing about HAProxy is that apart from providing a load balancing functionality it also provides some a feature that is specifically useful for using it as a C2-proxy: ACLs which allow you to redirect requests to a specific "backend" (C2) server based on properties of the request itself (such as the requested path)[4].
Below an example configuration file is shown which would configurate HAProxy as a C2-proxy for a PoshC2 project[5,6,7].
frontend httpnodes
bind *:443 ssl crt /etc/ssl/haproxy/haproxy.pem
mode http
# use backend poshc2 if the requested path begins with one of the paths in paths.acl
use backend poshc2 if { path_beg -f /etc/haproxy/paths.acl }
# use following backend if the requested path did not match the ACL.
default backend backendhttp
backend poshc2
# disable SSL-verification because we use self signed certificates
server c2 10.0.4.10:443 ssl verify none
backend backendhttp
server benign 127.0.0.1:8080 ssl verify none
The paths.acl file would look as follows:
/load/pages/index.php/
...
/Philips/v902/
The HAProxy also allows for more complex ACL-usage in which you redirect to a specific C2-server based on source IP. Furthermore I still use Apache2 for hosting a benign looking website which is hosted on the HAProxy host as well. However, the webserver only binds to localhost.
Describe alternatives you've considered
Research on Apache2 configuration options in order to find a missing (or misconfigured) option in order to still get the C2-proxy working with Apache2.
Additional context
If this feature request would be accepted I would very much be happy to submit a Pull request to implement the requested feature myself.
Is your feature request related to a problem? Please describe.
A few days ago I was playing around with using Apache2 as a C2-proxy between PoshC2 and active implants. After configuring Apache2 rewrite rules (used the rules from the PoshC2 project directory) I noticed right away that only HTTP GET-requests were coming through to PoshC2.
mod_rerwite
seemed only to be working specifically for GET-requests; I verified this by taking packet captures between the C2 - C2-proxy and C2-proxy-implant. Furthermore, the documentation of mod_rewrite and some posts on mod_rewrite in combination with POST-requests seem to support this conclusion[1,2,3].First of all, I apologize if I overlooked a configuration option which would make the Apache2 C2-proxy setup work with rewriting POST-request. If this is the case, you could just dismiss this feature request.
Describe the solution you'd like
The solution I propose is to modify PoshC2 in order that during project generation (and first startup of the C2-server) a HAProxy configuration template is generated; the same way this is currently done for Apache2 rewrite rules. The nice thing about HAProxy is that apart from providing a load balancing functionality it also provides some a feature that is specifically useful for using it as a C2-proxy: ACLs which allow you to redirect requests to a specific "backend" (C2) server based on properties of the request itself (such as the requested path)[4].
Below an example configuration file is shown which would configurate HAProxy as a C2-proxy for a PoshC2 project[5,6,7].
The
paths.acl
file would look as follows:The HAProxy also allows for more complex ACL-usage in which you redirect to a specific C2-server based on source IP. Furthermore I still use Apache2 for hosting a benign looking website which is hosted on the HAProxy host as well. However, the webserver only binds to localhost.
Describe alternatives you've considered
Research on Apache2 configuration options in order to find a missing (or misconfigured) option in order to still get the C2-proxy working with Apache2.
Additional context
If this feature request would be accepted I would very much be happy to submit a Pull request to implement the requested feature myself.
[1] - https://httpd.apache.org/docs/current/mod/mod_rewrite.html
[2] - https://serverfault.com/questions/68343/apache-2-mod-rewrite-how-to-read-post-parameters
[3] - https://www.sitepoint.com/community/t/does-mod-rewrite-work-with-post-data/2177
[4] - https://www.haproxy.com/blog/introduction-to-haproxy-acls/
[5] - https://serversforhackers.com/c/using-ssl-certificates-with-haproxy
[6] - https://www.tienle.com/2018/06-22/install-haproxy-with-ssl-termination.html
[7] - https://www.haproxy.com/blog/haproxy-ssl-termination/
The text was updated successfully, but these errors were encountered: