Skip to content

Commit 1891d66

Browse files
committed
Version bump
1 parent 0ff28cd commit 1891d66

File tree

7 files changed

+73
-105
lines changed

7 files changed

+73
-105
lines changed

README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Exploit Host HTTP
22

3-
Purpose made HTTP Docker file setup for hosting exploits for the web browser for Sony PlayStation devices and the Nintendo WiiU/Switch. This essentially has to be used with the [Exploit Host DNS](https://github.com/Al-Azif/exploit-host-DNS) component. It's possible to use it "standalone", but will require something to make the browser send the correct `Host` header with it's HTTP(S) requests.
3+
Purpose made HTTP Docker file setup for hosting exploits for the web browser for Sony PlayStation devices and the Nintendo Wii/WiiU/Switch. This essentially has to be used with the [Exploit Host DNS](https://github.com/Al-Azif/exploit-host-DNS) component. It's possible to use it "standalone", but will require something to make the browser send the correct `Host` header with it's HTTP(S) requests.
44

55
## Features
66

@@ -16,7 +16,7 @@ When used in conjunction with [Exploit Host DNS](https://github.com/Al-Azif/expl
1616

1717
## Usage
1818

19-
This is setup to work right out of the box with [Exploit Host DNS](https://github.com/Al-Azif/exploit-host-DNS). However there are lots of options for your individual hosting wants/needs. I'll only show the basic usage here.
19+
This is setup to work right out of the box with [Exploit Host DNS](https://github.com/Al-Azif/exploit-host-DNS). There are a lot of options for your individual hosting wants/needs; however, I'll only show the basic usage here.
2020

2121
### Command Line
2222

@@ -26,7 +26,7 @@ This command will always pull the latest image from Docker Hub, run on the main
2626

2727
### Composer
2828

29-
This composer file will do the same as the commands above.
29+
This composer file will do the same as the command above.
3030

3131
```yml
3232
---
@@ -47,21 +47,21 @@ Start the compose file by calling `docker compose up -d` from the same location
4747

4848
## Options (Environment Variables)
4949

50-
| Option | Default | Type | Info |
51-
|:--------------------------------|:--------------|:--------|:----------------|
52-
| DEBUG | `false` | boolean | Show debug output for `entrypoint.sh` in the Docker log. |
53-
| ROOT_DOMAIN | `the.gate` | string | |
54-
| NGINX_ACCESS_LOG | `false` | boolean | |
55-
| NGINX_ERROR_LOG | `false` | boolean | |
56-
| NGINX_ERROR_LOG_LEVEL | `warn` | string | |
57-
| REDIRECT_TYPE | `http` | string | |
58-
| HIJACK_URL | `ROOT_DOMAIN` | string | |
59-
| TLS | `self` | string | |
60-
| CF_IP_CORRECTION | `false` | boolean | |
61-
| CF_STRICT | `false` | boolean | |
62-
| OCSP_STAPLING | `false` | boolean | |
63-
| SEVER_HASH_BUCKET_SIZE_OVERRIDE | `false` | boolean | |
64-
| HEALTHCHECK_BYPASS | `false` | boolean | |
50+
| Option | Default | Type | Info |
51+
|:--------------------------------|:--------------|:---------------|:---------|
52+
| DEBUG | `false` | boolean | Show debug output for `entrypoint.sh` in the Docker log. |
53+
| REDIRECT_TYPE | `http` | string | The protocol that is used for the hijacked landing page redirect. Valid values are `http` and `https`. |
54+
| ROOT_DOMAIN | `the.gate` | string | The root domain that is used for hijacked landing page redirect. This is **ONLY** the domain itself. |
55+
| ROOT_DOMAIN_PATH | none | string | Additional path to append to root domain for redirect. If needed you can add an alternative port here as well. |
56+
| HIJACK_URL | none | string | Rather than hosting the hijacked landing page just redirect the request to another domain hosted elsewhere. If this is set, `ROOT_DOMAIN` and `ROOT_DOMAIN_PATH` are ignored. |
57+
| NGINX_ACCESS_LOG | `false` | boolean | Enables the NGINX access log, located at `/var/log/nginx/access.log` |
58+
| NGINX_ERROR_LOG | `false` | boolean | Enables the NGINX error log, located at `/var/log/nginx/error.log` |
59+
| NGINX_ERROR_LOG_LEVEL | `warn` | string | The error log level for the NGINX error log. Valid values are `debug`, `info`, `notice`, `warn`, `error`, `crit`, `alert`, `emerg`. Ignored if `NGINX_ERROR_LOG` is `false` |
60+
| TLS | `self` | string | Valid values are `self`, `letsencrypt`, and `mount`. |
61+
| CF_IP_CORRECTION | `false` | boolean | Automatically correct CloudFlare IP addresses to the real IP address for logging. |
62+
| CF_STRICT | `false` | boolean | |
63+
| OCSP_STAPLING | `false` | boolean | |
64+
| SEVER_HASH_BUCKET_SIZE_OVERRIDE | `false` | boolean | Overrides the `server_names_hash_bucket_size` option in NGINX to be `64`. Some systems have `32` as the default and that is not enough for our usage |
6565

6666
## TODO
6767

entrypoint.sh

+9-60
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ set -e
44

55
# Input defaults and text to lower case
66
DEBUG=${DEBUG:-"false"} && DEBUG=$(echo "$DEBUG" | tr "[:upper:]" "[:lower:]")
7+
REDIRECT_TYPE=${REDIRECT_TYPE:-"http"} && REDIRECT_TYPE=$(echo "$REDIRECT_TYPE" | tr "[:upper:]" "[:lower:]")
78
ROOT_DOMAIN=${ROOT_DOMAIN:-"the.gate"} && ROOT_DOMAIN=$(echo "$ROOT_DOMAIN" | tr "[:upper:]" "[:lower:]")
9+
ROOT_DOMAIN_PATH=${ROOT_DOMAIN_PATH:-""}
810
NGINX_ACCESS_LOG=${NGINX_ACCESS_LOG:-"false"} && NGINX_ACCESS_LOG=$(echo "$NGINX_ACCESS_LOG" | tr "[:upper:]" "[:lower:]")
911
NGINX_ERROR_LOG=${NGINX_ERROR_LOG:-"false"} && NGINX_ERROR_LOG=$(echo "$NGINX_ERROR_LOG" | tr "[:upper:]" "[:lower:]")
1012
NGINX_ERROR_LOG_LEVEL=${NGINX_ERROR_LOG_LEVEL:-"warn"} && NGINX_ERROR_LOG_LEVEL=$(echo "$NGINX_ERROR_LOG_LEVEL" | tr "[:upper:]" "[:lower:]")
11-
REDIRECT_TYPE=${REDIRECT_TYPE:-"http"} && REDIRECT_TYPE=$(echo "$REDIRECT_TYPE" | tr "[:upper:]" "[:lower:]")
12-
HIJACK_URL=${HIJACK_URL:-"${ROOT_DOMAIN}"}
1313
TLS=${TLS:-"self"} && TLS=$(echo "$TLS" | tr "[:upper:]" "[:lower:]")
1414
CF_IP_CORRECTION=${CF_IP_CORRECTION:-"false"} && CF_IP_CORRECTION=$(echo "$CF_IP_CORRECTION" | tr "[:upper:]" "[:lower:]")
1515
CF_STRICT=${CF_STRICT:-"false"} && CF_STRICT=$(echo "$CF_STRICT" | tr "[:upper:]" "[:lower:]")
1616
OCSP_STAPLING=${OCSP_STAPLING:-"false"} && OCSP_STAPLING=$(echo "$OCSP_STAPLING" | tr "[:upper:]" "[:lower:]")
1717
SEVER_HASH_BUCKET_SIZE_OVERRIDE=${SEVER_HASH_BUCKET_SIZE_OVERRIDE:-"false"} && SEVER_HASH_BUCKET_SIZE_OVERRIDE=$(echo "$SEVER_HASH_BUCKET_SIZE_OVERRIDE" | tr "[:upper:]" "[:lower:]")
18-
HEALTHCHECK_BYPASS=${HEALTHCHECK_BYPASS:-"false"} && HEALTHCHECK_BYPASS=$(echo "$HEALTHCHECK_BYPASS" | tr "[:upper:]" "[:lower:]")
1918

2019
# Input validation
2120
if [ "$DEBUG" != "true" ] && [ "$DEBUG" != "false" ]; then
@@ -53,20 +52,6 @@ if [ "$REDIRECT_TYPE" != "http" ] && [ "$REDIRECT_TYPE" != "https" ]; then
5352
exit 1
5453
fi
5554

56-
if [ -n "$HTTP_REDIRECT_PORT" ]; then
57-
if [ "$HTTP_REDIRECT_PORT" -lt 0 ] || [ "$HTTP_REDIRECT_PORT" -gt 65535 ]; then
58-
echo "[!] Invalid option for HTTP_REDIRECT_PORT, expected 0 through 65535"
59-
exit 1
60-
fi
61-
fi
62-
63-
if [ -n "$HTTPS_REDIRECT_PORT" ]; then
64-
if [ "$HTTPS_REDIRECT_PORT" -lt 0 ] || [ "$HTTPS_REDIRECT_PORT" -gt 65535 ]; then
65-
echo "[!] Invalid option for HTTPS_REDIRECT_PORT, expected 0 through 65535"
66-
exit 1
67-
fi
68-
fi
69-
7055
if [ "$TLS" != "self" ] && [ "$TLS" != "letsencrypt" ] && [ "$TLS" != "mount" ]; then
7156
echo "[!] Invalid option for TLS, expected \"self\", \"letsencrypt\", \"mount\""
7257
exit 1
@@ -97,39 +82,22 @@ if [ "$OCSP_STAPLING" != "true" ] && [ "$OCSP_STAPLING" != "false" ]; then
9782
exit 1
9883
fi
9984

100-
if [ "$HEALTHCHECK_BYPASS" != "true" ] && [ "$HEALTHCHECK_BYPASS" != "false" ]; then
101-
echo "[!] Invalid option for HEALTHCHECK_BYPASS, expected \"true\" or \"false\""
102-
exit 1
103-
fi
104-
10585
if [ "$DEBUG" = "true" ]; then
10686
echo "=== DEBUG ====================================================="
107-
if [ "$ROOT_DOMAIN" = "$HIJACK_URL" ]; then
108-
echo "ROOT_DOMAIN » $ROOT_DOMAIN"
109-
else
110-
echo "HIJACK_URL » $HIJACK_URL"
111-
fi
87+
echo "REDIRECT_TYPE » $REDIRECT_TYPE"
88+
echo "ROOT_DOMAIN » $ROOT_DOMAIN"
89+
echo "ROOT_DOMAIN_PATH » $ROOT_DOMAIN_PATH"
11290
echo "NGINX_ACCESS_LOG » $NGINX_ACCESS_LOG"
11391
echo "NGINX_ERROR_LOG » $NGINX_ERROR_LOG"
11492
echo "NGINX_ERROR_LOG_LEVEL » $NGINX_ERROR_LOG_LEVEL"
11593
echo "SEVER_HASH_BUCKET_SIZE_OVERRIDE » $SEVER_HASH_BUCKET_SIZE_OVERRIDE"
116-
if [ "$ROOT_DOMAIN" = "$HIJACK_URL" ]; then
117-
echo "REDIRECT_TYPE » $REDIRECT_TYPE"
118-
if [ "$REDIRECT_TYPE" != "http" ] && [ -n "$HTTP_REDIRECT_PORT" ]; then
119-
echo "HTTP_REDIRECT_PORT » $HTTP_REDIRECT_PORT"
120-
fi
121-
if [ "$REDIRECT_TYPE" != "https" ] && [ -n "$HTTPS_REDIRECT_PORT" ]; then
122-
echo "HTTPS_REDIRECT_PORT » $HTTPS_REDIRECT_PORT"
123-
fi
124-
fi
12594
echo "TLS » $TLS"
12695
if [ -n "$CERTBOT_EMAIL" ]; then
12796
echo "CERTBOT_EMAIL » $CERTBOT_EMAIL"
12897
fi
12998
echo "CF_IP_CORRECTION » $CF_IP_CORRECTION"
13099
echo "CF_STRICT » $CF_STRICT"
131100
echo "OCSP_STAPLING » $OCSP_STAPLING"
132-
echo "HEALTHCHECK_BYPASS » $HEALTHCHECK_BYPASS"
133101
echo "==============================================================="
134102
fi
135103

@@ -138,14 +106,8 @@ if [ -n "$REDIRECT_TYPE" ]; then
138106
export REDIRECT_TYPE=$REDIRECT_TYPE
139107
fi
140108

141-
if [ "$ROOT_DOMAIN" = "$HIJACK_URL" ]; then
142-
if [ -n "$HTTP_REDIRECT_PORT" ]; then
143-
export HTTP_REDIRECT_PORT=$HTTP_REDIRECT_PORT
144-
fi
145-
146-
if [ -n "$HTTPS_REDIRECT_PORT" ]; then
147-
export HTTPS_REDIRECT_PORT=$HTTPS_REDIRECT_PORT
148-
fi
109+
if [ -n "$ROOT_DOMAIN_PATH" ]; then
110+
export ROOT_DOMAIN_PATH=$ROOT_DOMAIN_PATH
149111
fi
150112

151113
# Delete all files in sites-available and sites-enabled. In case this isn't fresh instance
@@ -155,14 +117,7 @@ rm -rf /etc/nginx/sites-enabled/* 2> /dev/null || true
155117
# Copy (while overwriting files) from /etc/nginx/templates into /etc/nginx/
156118
cp -rf /etc/nginx/templates/* /etc/nginx
157119

158-
if [ "$ROOT_DOMAIN" = "$HIJACK_URL" ]; then
159-
echo "[-] Using \"$ROOT_DOMAIN\" to host"
160-
else
161-
echo "[-] Redirecting hijacked page to \"$REDIRECT_TYPE://$HIJACK_URL\""
162-
if [ -f /etc/nginx/sites-available/ROOT_DOMAIN ]; then
163-
rm -f /etc/nginx/sites-available/ROOT_DOMAIN
164-
fi
165-
fi
120+
echo "[-] Using \"$REDIRECT_TYPE://$ROOT_DOMAIN$ROOT_DOMAIN_PATH\" as host"
166121

167122
# Setup Cloudflare IP correction
168123
if [ "$CF_IP_CORRECTION" = "false" ]; then
@@ -218,13 +173,7 @@ done
218173
# Replace variables in the files in the `/etc/nginx/sites-available/` directory
219174
echo "[-] Replacing variables in vHost files..."
220175
for file in /etc/nginx/sites-available/*; do
221-
if [ "$ROOT_DOMAIN" = "$HIJACK_URL" ]; then
222-
sed -i "s/{{ROOT_DOMAIN}}/$ROOT_DOMAIN/g" "$file"
223-
else
224-
# TODO: Escape all?
225-
ESCAPED_URL=$(printf '%s\n' "$HIJACK_URL" | sed -e 's/[]\/$*.^[]/\\&/g');
226-
sed -i "s/{{ROOT_DOMAIN}}/$ESCAPED_URL/g" "$file"
227-
fi
176+
sed -i "s/{{ROOT_DOMAIN}}/$ROOT_DOMAIN/g" "$file"
228177

229178
# TODO: Bind to IPv4 interface if it's available
230179

healthcheck.sh

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/bin/ash
22
# shellcheck shell=dash
33

4-
if [ "$HEALTHCHECK_BYPASS" = "true" ]; then
5-
exit 0
6-
fi
7-
84
# Check Nintendo Landing Pages
95

106
# Check PlayStation Landing Pages

nginx/nginx.conf

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ pcre_jit on;
88

99
# Needed to read environmental variable in hijacked-landing-pages
1010
env REDIRECT_TYPE;
11-
env HTTP_REDIRECT_PORT;
12-
env HTTPS_REDIRECT_PORT;
11+
env ROOT_DOMAIN_PATH;
1312

1413
events {
1514
multi_accept on;
@@ -78,8 +77,8 @@ http {
7877
# Logging Settings
7978
##
8079

81-
access_log off; # /var/log/nginx/nginx-access.log;
82-
error_log /dev/null; # /var/log/nginx/nginx-error.log {{NGINX_ERROR_LOG_LEVEL}};
80+
access_log off; # /var/log/nginx/access.log;
81+
error_log /dev/null; # /var/log/nginx/error.log {{NGINX_ERROR_LOG_LEVEL}};
8382

8483
##
8584
# Compression Settings

nginx/vhosts/hijacked-landing-pages

+41-17
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,11 @@ server {
2626
return os.getenv("REDIRECT_TYPE");
2727
}
2828

29-
set_by_lua_block $HTTP_REDIRECT_PORT {
30-
return os.getenv("HTTP_REDIRECT_PORT");
31-
}
32-
if ($HTTP_REDIRECT_PORT) {
33-
set $HTTP_REDIRECT_PORT ":$HTTP_REDIRECT_PORT";
29+
set_by_lua_block $ROOT_DOMAIN_PATH {
30+
return os.getenv("ROOT_DOMAIN_PATH");
3431
}
3532

36-
set_by_lua_block $HTTPS_REDIRECT_PORT {
37-
return os.getenv("HTTPS_REDIRECT_PORT");
38-
}
39-
if ($HTTPS_REDIRECT_PORT) {
40-
set $HTTPS_REDIRECT_PORT ":$HTTPS_REDIRECT_PORT";
41-
}
42-
43-
set $REDIRECT_URL "$REDIRECT_TYPE://{{ROOT_DOMAIN}}$HTTP_REDIRECT_PORT";
44-
if ($REDIRECT_TYPE = https) {
45-
set $REDIRECT_URL "$REDIRECT_TYPE://{{ROOT_DOMAIN}}$HTTPS_REDIRECT_PORT";
46-
}
33+
set $REDIRECT_URL "$REDIRECT_TYPE://{{ROOT_DOMAIN}}$ROOT_DOMAIN_PATH";
4734

4835
set $REDIRECT "<!DOCTYPE html>";
4936
set $REDIRECT "${REDIRECT}<html manifest=\"/redirect.manifest\">";
@@ -107,7 +94,44 @@ server {
10794
}
10895

10996
location / {
110-
return 403;
97+
return 444;
98+
}
99+
100+
include general.conf;
101+
}
102+
103+
server {
104+
charset utf-8;
105+
chunked_transfer_encoding on;
106+
107+
include error.conf;
108+
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 @error_html;
109+
110+
listen 0.0.0.0:80;
111+
listen 0.0.0.0:443 ssl http2;
112+
#{{IPV6}} listen [::]:80;
113+
#{{IPV6}} listen [::]:443 ssl http2;
114+
server_name cfh.wapp.wii.com;
115+
116+
ssl_certificate /etc/nginx/certs/snakeoil.crt;
117+
ssl_certificate_key /etc/nginx/certs/private/snakeoil.key;
118+
119+
set_by_lua_block $REDIRECT_TYPE {
120+
return os.getenv("REDIRECT_TYPE");
121+
}
122+
123+
set_by_lua_block $ROOT_DOMAIN_PATH {
124+
return os.getenv("ROOT_DOMAIN_PATH");
125+
}
126+
127+
set $REDIRECT_URL "$REDIRECT_TYPE://{{ROOT_DOMAIN}}$ROOT_DOMAIN_PATH";
128+
129+
location ~* "^/eula/[0-9]{3}/[a-z]{2}\.html" {
130+
return 302 $REDIRECT_URL/;
131+
}
132+
133+
location / {
134+
return 444;
111135
}
112136

113137
include general.conf;

nginx/vhosts/ps-net-tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ server {
5656
}
5757

5858
location / {
59-
return 403;
59+
return 444;
6060
}
6161

6262
include general.conf;

nginx/vhosts/ps-sys-updates

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ server {
8686
}
8787

8888
location / {
89-
return 403;
89+
return 444;
9090
}
9191

9292
include general.conf;

0 commit comments

Comments
 (0)