Summary
The Online Food Ordering System 2.0 contains a file inclusion vulnerability in index.php, where the page parameter is used directly in an include operation.
A remote attacker can manipulate this parameter to load arbitrary server-side files, potentially leading to information disclosure, code execution, or application compromise when certain conditions are met.
Affected context
The vulnerability occurs in PHP-based deployments of the Online Food Ordering System 2.0 where index.php routes requests by including other PHP files based on a page parameter.
It is typically present when:
- The page argument is taken directly from user input (e.g., GET/POST) without strict validation or whitelisting
- The include statement in index.php uses this parameter dynamically
- Web server and PHP settings allow inclusion of arbitrary local files, and in some cases remote resources if enabled
Real-world risk depends on the available files, the presence of executable PHP content, and server hardening.
Exploit preconditions
- Attack surface: Public web interface of index.php
- Required access: Remote network access to the web application (no prior authentication necessarily required, depending on routing logic)
- Trigger point: HTTP requests that control the page parameter consumed by index.php's include function
- Why exploitation is possible: The application trusts user-controlled input to build include paths, without robust normalization, whitelisting, or restriction to a fixed set of templates, allowing attackers to direct PHP to include unintended files.
Why this happens
This vulnerability stems from dynamic file inclusion based on untrusted input, a pattern covered by CWE-73: External Control of File Name or Path.
The index.php file likely uses a construct similar to include($_GET['page'] . '.php') or equivalent, allowing the user to influence which file the PHP engine loads and executes.
Without strict whitelisting, canonicalization, or isolation of includable files, an attacker can traverse directories, include sensitive local resources, or in some configurations inject executable content, turning routine routing logic into an arbitrary file inclusion primitive.
Potential impact
- Access to sensitive local files (configuration files, credentials, or source code) via path manipulation
- Execution of arbitrary PHP code if the attacker can cause inclusion of files they control or log files with injected payloads
- Bypassing of application logic and access controls by directly including privileged scripts
- Escalation from a simple information disclosure to full server compromise in weakly hardened environments
General mitigation guidance
Effective mitigation focuses on eliminating user-controlled file paths and restricting what can be included:
- Replace dynamic file inclusion with a fixed whitelist mapping allowed page identifiers to specific script filenames
- Avoid passing raw request parameters into include/require statements; instead, use internal route resolution logic
- Normalize and validate any file-related input to ensure it stays within an expected directory and does not contain traversal sequences
- Separate public templates from executable logic and store them outside of directories that can be interpreted as PHP code where possible
- Run the application with least-privilege file permissions so that even if a path is misused, critical system and configuration files are not readable or executable by the web process
How teams detect issues like this
Detection generally involves both code-centric and runtime approaches:
- Static analysis: Search for include, include_once, require, or require_once calls using variables derived from $_GET, $_POST, or other request data; automated SAST tools can flag these patterns and missing whitelisting
- Code review: Look for routing logic that directly concatenates user input into file paths, especially in central entry points like index.php
- Configuration review: Assess PHP and web server settings (e.g., inclusion of remote URLs, open_basedir) to understand possible inclusion scope
- Runtime monitoring: Inspect logs and WAF alerts for suspicious page parameter values containing directory traversal patterns (../), null bytes, or unexpected extensions

