PAGI::FastAPI versions from 1.0.0 up to but not including 1.4.0 for Perl do not apply registered authentication or CSRF middleware when using the to_app entry point. This allows remote attackers to access protected routes without credentials and perform cross-site request forgery (CSRF) attacks. The issue arises because the to_app function does not apply the middleware stack where authentication and CSRF protections reside, although middleware registered as code references are unaffected. The vulnerability is fixed in version 1.4.0.