Compare commits

...

6 Commits

Author SHA1 Message Date
Ilia Ross
463fcea730 Fix to require trusted proxies for SSL client cert headers
This PR tightens handling of proxied SSL client certificate headers so they are only honored when Webmin is configured to trust SSL headers and the direct TCP peer matches an explicit `trusted_proxies` entry.

The change preserves legacy forwarded-IP behavior for `trust_real_ip`, but prevents ambiguous legacy configs with no trusted proxy from accepting spoofable `X-SSL-Client-*` headers as authentication identity. During postinstall, such legacy configs now default to `no_trust_ssl=1`.
2026-06-30 14:23:01 +02:00
Jamie Cameron
a94ff2c49a Merge branch 'master' of github.com:webmin/webmin
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
Close inactive / close-inactive (push) Has been cancelled
2026-06-29 20:18:06 -07:00
Jamie Cameron
ec78452e7b Add missing icons 2026-06-29 20:17:23 -07:00
Ilia Ross
a7325b9087 Update changelog for 2.652 2026-06-30 01:47:25 +02:00
Ilia Ross
cc4bb35dee Update tests to recognize hex numeric HTML entities
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
2026-06-29 23:28:48 +02:00
Ilia Ross
aa2282778e Fix to recognize hex numeric HTML entities
https://forum.virtualmin.com/t/char-redered-as-x25e6/137494/6?u=ilia
2026-06-29 23:28:28 +02:00
9 changed files with 30 additions and 11 deletions

View File

@@ -1,5 +1,8 @@
## Changelog
#### 2.652 (July, 2026)
* Fix to recognize hex numeric HTML entities to work in various elements
#### 2.651 (June 28, 2026)
* Fix Certbot-backed certificate requests and renewals to correctly parse PEM paths after issuance
* Fix live activation of Linux bond interfaces [#2777](https://github.com/webmin/webmin/pull/2777)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
grub2/images/icon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
kea-dhcp/images/icon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

View File

@@ -1542,16 +1542,25 @@ if ($headerhost) {
$headerhost = undef if (!&check_ipaddress($headerhost) &&
!&check_ip6address($headerhost));
}
# If trusted_proxies is configured, header-supplied client IP and SSL
# client info are only honored when the direct TCP peer is in that list.
# Otherwise drop them so an attacker reaching miniserv directly cannot
# spoof X-Forwarded-For or X-SSL-Client-* to bypass auth.
if ($config{'trust_real_ip'} && $config{'trusted_proxies'} ne '' &&
!&ip_match($acptip, $localip,
split(/\s+/, $config{'trusted_proxies'}))) {
# If trusted_proxies is configured, header-supplied client IP is only
# honored when the direct TCP peer is in that list. Proxied SSL client
# cert headers carry authentication identity, so only honor those from
# an explicitly trusted proxy.
my @trusted_proxies = split(/\s+/, $config{'trusted_proxies'} || "");
my $trusted_proxy = @trusted_proxies &&
&ip_match($acptip, $localip, @trusted_proxies);
my $trust_ssl_client_headers = $config{'trust_real_ip'} &&
!$config{'no_trust_ssl'} && $trusted_proxy;
if ($config{'trust_real_ip'} && @trusted_proxies && !$trusted_proxy) {
print DEBUG "handle_request: peer $acptip not in trusted_proxies; ".
"ignoring forwarding and SSL client headers\n";
"ignoring forwarding headers\n";
$headerhost = undef;
}
if (!$trust_ssl_client_headers) {
print DEBUG "handle_request: ignoring SSL client headers from ".
"peer $acptip\n"
if ($header{'x-ssl-client-dn'} ||
$header{'x-ssl-client-verify'});
delete $header{'x-ssl-client-dn'};
delete $header{'x-ssl-client-verify'};
}

View File

@@ -38,6 +38,9 @@ subtest 'html_escape' => sub {
is(main::html_escape('&'), '&', 'default mode double-escapes &');
is(main::html_escape('&', 1), '&', 'nodblamp preserves existing &');
is(main::html_escape('A', 1), 'A', 'nodblamp preserves numeric entity');
is(main::html_escape('◦', 1), '◦', 'nodblamp preserves hex numeric entity');
is(main::html_escape('◦', 1), '◦', 'nodblamp preserves uppercase hex numeric entity');
is(main::html_escape('&#xZZ;', 1), '&#xZZ;', 'nodblamp escapes invalid hex numeric entity');
# Note: nodblamp's lookahead matches any &<letters>; as an entity, so
# made-up names like &x; are treated as entities and not re-escaped.
is(main::html_escape('&x;', 1), '&x;', 'nodblamp preserves arbitrary &word; shape');

View File

@@ -302,7 +302,7 @@ if (!defined $tmp) {
};
# Before escaping ampersand use negative lookahead to see if occurrence
# is not an HTML entity already to prevent double escaping (optionally)
$tmp =~ s/&(?!(([a-zA-Z]+)|(#|#x)\d+);)/&amp;/g if ($nodblamp);
$tmp =~ s/&(?!([a-zA-Z]+|#\d+|#[xX][0-9A-Fa-f]+);)/&amp;/g if ($nodblamp);
# Always escape all ampersands by default
# to make sure they are displayed per se
$tmp =~ s/&/&amp;/g if (!$nodblamp);

View File

@@ -60,8 +60,12 @@ if (!-r $first_install_file || $miniserv{'login_script'} eq $record_login_cmd) {
$miniserv{'failed_script'} = $record_failed_cmd;
}
# Disable trusting SSL certs unless already enabled
if (!$miniserv{'trust_real_ip'} && !defined($miniserv{'no_trust_ssl'})) {
# Disable trusting SSL certs unless already enabled. Legacy configs with
# trust_real_ip but no trusted proxy cannot safely authenticate from
# proxied SSL client cert headers.
my @trusted_proxies = split(/\s+/, $miniserv{'trusted_proxies'} || "");
if ((!$miniserv{'trust_real_ip'} || !@trusted_proxies) &&
!defined($miniserv{'no_trust_ssl'})) {
$miniserv{'no_trust_ssl'} = 1;
}