Skip to content

Commit e5f67fb

Browse files
LiteSpeed: document security considerations for executed paths (#24450)
Make it clear that the `init_request_info()` function is indeed meant to be using `LSAPI_GetScriptFileName()` without any validation, and document in the README file that this lack of validation is another reason why only trusted sources should be granted direct access to the listener.
1 parent dc96604 commit e5f67fb

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎sapi/litespeed/README.md‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,20 @@ have lsphp bind to address 192.168.0.2:3000,
7676

7777
have lsphp accept request on Unix domain socket `/tmp/lsphp_manual.sock`.
7878

79-
### INI Security
79+
### Listener Security
8080

8181
The lsphp listener must only be reachable by trusted sources, generally just
82-
the LiteSpeed web front end. Any source that can set its own environment variables
83-
can configure arbitrary PHP INI directives at the `ZEND_INI_SYSTEM` level for
84-
that request. This is the equivalent level of access as the Apache
85-
`php_admin_value` directive or the FPM's `PHP_ADMIN_VALUE` parameter.
82+
the LiteSpeed web front end. Allowing access from other sources may cause
83+
security issues:
84+
85+
* Any source that can set its own environment variables can configure arbitrary
86+
PHP INI directives at the `ZEND_INI_SYSTEM` level for that request. This is the
87+
equivalent level of access as the Apache `php_admin_value` directive or the
88+
FPM `PHP_ADMIN_VALUE` parameter.
89+
* Any source that can invoke the lsphp listener can choose what file to execute
90+
based on the request contents. The file to execute is the file name reported by
91+
`LSAPI_GetScriptFileName()`, without additional validation. Specifically, there
92+
is no enforcement of a docroot or `open_basedir` restriction.
8693

8794
## Using LiteSpeed PHP with LiteSpeed Web Server
8895

‎sapi/litespeed/lsapi_main.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,11 @@ static sapi_module_struct lsapi_sapi_module =
621621
};
622622
/* }}} */
623623

624+
/* SG(request_info).path_translated comes from LSAPI_GetScriptFileName() without
625+
* any additional validation; this is intentional, and is the mechanism by which
626+
* LiteSpeed communicates the file to execute. The LiteSpeed listener should
627+
* only be reachable from trusted callers. See README.md in this directory for
628+
* more details. */
624629
static void init_request_info( void )
625630
{
626631
char * pContentType = LSAPI_GetHeader( H_CONTENT_TYPE );

0 commit comments

Comments
 (0)