Skip to content

Security issue on nginx conf sample #549

Description

@SebFrango

The ngninx conf sample file provided in the applicatoin server folder handle the regex php file like this:

 location ~ (index|get|static|report|404|503|health_check.php)\.php$ {
           try_files       $fastcgi_script_name $uri/;
           index           index.php;
           ....

whereas in the nginx conf provided with the native magento2 install folder, the php file are handle like this:

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;

You can see that the regex is far more secure on the native nginx conf : for instance , only a file from root /index.php can be executed, whereas on the application server , every file ending by index.php in every public folder will be executed.

So this issue combined with the polyshell issue , allow an attacker to uplaod an 99index.php file in media/custom_options , and can access it and execute it !! (also the deny all on custom_options or customer_address is not present in this nginx conf file )

So , my point is , why the nginx conf file from application server is not up to date in security with the native nginx conf magento2 file

Thanks

Sebastie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions