Security Advisories (1)
CVE-2026-7381 (2026-04-29)

Plack::Middleware::XSendfile versions through 1.0053 for Perl can allow client-controlled path rewriting. Plack::Middleware::XSendfile allows the variation setting (sendfile type) to be set by the client via the X-Sendfile-Type header, if it is not considered in the middleware constructor or the Plack environment. A malicious client can set the X-Sendfile-Type header to "X-Accel-Redirect" to services running behind nginx reverse proxies, and then set the X-Accel-Mapping to map the path to an arbitrary file on the server. Since 1.0053, Plack::Middleware::XSendfile is deprecated and will be removed from future releases of Plack. This is similar to CVE-2025-61780 for Rack::Sendfile, although Plack::Middleware::XSendfile has some mitigations that disallow regular expressions to be used in the mapping, and only apply the mapping for the "X-Accel-Redirect" type.

NAME

Plack::Middleware::Auth::Basic - Simple basic authentication middleware

SYNOPSIS

use Plack::Builder;
my $app = sub { ... };

builder {
    enable "Auth::Basic", authenticator => \&authen_cb;
    $app;
};

sub authen_cb {
    my($username, $password, $env) = @_;
    return $username eq 'admin' && $password eq 's3cr3t';
}

DESCRIPTION

Plack::Middleware::Auth::Basic is a basic authentication handler for Plack.

CONFIGURATION

authenticator

A callback function that takes username, password and PSGI environment supplied and returns whether the authentication succeeds. Required.

Authenticator can also be an object that responds to authenticate method that takes username and password and returns boolean, so any backends for Authen::Simple are perfect to use:

use Authen::Simple::LDAP;
enable "Auth::Basic", authenticator => Authen::Simple::LDAP->new(...);

For authentication based on htpasswd files:

use Authen::Simple::Passwd;
enable "Auth::Basic",
  realm => "Password protected area",
  authenticator => Authen::Simple::Passwd->new(
    path => "/path/to/.htpasswd",
  );
realm

Realm name to display in the basic authentication dialog. Defaults to restricted area.

LIMITATIONS

This middleware expects that the application has a full access to the headers sent by clients in PSGI environment. That is normally the case with standalone Perl PSGI web servers such as Starman or HTTP::Server::Simple::PSGI.

However, in a web server configuration where you can't achieve this (i.e. using your application via Apache's mod_cgi), this middleware does not work since your application can't know the value of Authorization: header.

If you use Apache as a web server and CGI to run your PSGI application, you can either a) compile Apache with -DSECURITY_HOLE_PASS_AUTHORIZATION option, or b) use mod_rewrite to pass the Authorization header to the application with the rewrite rule like following.

RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

AUTHOR

Tatsuhiko Miyagawa

SEE ALSO

Plack