Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
SECURE CODE REVIEW · PHP 8.x

PHP Website Security Review: Shells, XSS, Upload Vulnerabilities and Malicious Code

A website is not secure simply because it works. Rapidly developed or AI-assisted PHP projects can miss authorization, upload validation, contextual output encoding, prepared statements, CSRF, session and secret-management controls. This guide explains what to review and why without teaching exploit payloads.

Eka Sunucu PHP code security review covering upload, XSS and SQL injection
Technical investigation image
UploadFile validation + safer storage
XSSOutput encoding + sanitization
SQLPrepared statement + least privilege
AuthAuthorization + session

Contents

  1. Why AI-assisted PHP code still needs a security review
  2. Unrestricted file upload: a major path to server-side compromise
  3. XSS: why strip_tags alone is not enough
  4. SQL Injection: using PDO is not automatically safe
  5. Command injection and RCE surface
  6. IDOR and authorization: can changing /order/123 expose another user?
  7. CSRF on state-changing requests
  8. Session, cookie and password security
  9. Prevent .env, debug, backup and source-code leaks
  10. Supported PHP versions in 2026
  11. Filesystem, web-server and upload-directory hardening
  12. How EKA performs a PHP source-code security review

Why AI-assisted PHP code still needs a security review

Code-generation tools accelerate development but do not automatically know your production trust boundaries, framework version or deployment policy. A functional upload endpoint can still lack authorization, MIME validation or safe storage.

Review the complete route → middleware → controller → storage → database flow. Authentication confirms identity; authorization must independently confirm access to each resource.

Unrestricted file upload: a major path to server-side compromise

OWASP recommends allowlisted extensions, server-side file-type validation, generated filenames, size limits, authorized uploaders and storage outside webroot where possible.

A “block .php” blacklist alone is weak. Review double extensions, server handlers, MIME/signature validation, filename normalization and whether uploaded content can execute.

XSS: why strip_tags alone is not enough

XSS prevention depends on contextual output encoding. HTML body, attribute, JavaScript, CSS and URL contexts require different handling; rich HTML needs a trusted sanitizer.

Admin panels can also be XSS targets through customer names, product descriptions, comments, search terms or log viewers. CSP is defense in depth, not a replacement for correct encoding.

SQL Injection: using PDO is not automatically safe

PDO can still be used unsafely if user input is concatenated into SQL. OWASP recommends parameterized queries/prepared statements as a primary defense.

Dynamic identifiers such as sort columns need allowlists. Apply least privilege to the database account to reduce impact if an injection flaw exists.

SAFE EXAMPLE
$sorgu = $pdo->prepare("SELECT id, ad FROM kullanicilar WHERE email = :email LIMIT 1");
$sorgu->execute([':email' => $email]);

Command injection and RCE surface

Directly combining user input with shell_exec, system, exec, passthru or proc_open is high risk. OWASP recommends avoiding OS commands when a language/library API can do the job.

If command execution is truly required, use a fixed executable and argument schema, allowlists, least-privileged service identity and timeouts. One escaping function is not a complete design control.

IDOR and authorization: can changing /order/123 expose another user?

Authentication tells you who the user is; authorization decides whether that user may access a specific object. Query every protected resource in the current user/tenant scope rather than trusting a numeric ID.

Administrative actions need server-side role/permission checks. Hiding a button in the UI is not authorization.

CSRF on state-changing requests

Because browsers automatically send session cookies, state-changing endpoints need appropriate CSRF defenses. Tokens, SameSite cookies and Origin/Referer checks can be combined depending on architecture.

Prioritize delete operations, email/account changes, privileged role changes and file uploads. Avoid changing server state through GET requests.

Session, cookie and password security

Use Secure, HttpOnly and appropriate SameSite cookie settings, rotate session IDs after login, invalidate sessions on logout and rate-limit authentication. MFA is strongly recommended for privileged accounts.

Store passwords with password_hash/password_verify using current algorithms, never plain text, MD5 or SHA1. Reset tokens should be single-use, short-lived and unpredictable.

Prevent .env, debug, backup and source-code leaks

Do not expose .env, .git, SQL dumps, ZIP backups, logs or debug stack traces in public webroot. Keep API keys and database credentials out of repositories.

Production should disable verbose debug output while keeping protected technical logs available to operators.

Supported PHP versions in 2026

According to the official PHP support table in August 2026, PHP 8.2 is in security support and 8.3, 8.4 and 8.5 are supported branches. PHP 8.1 reached end of life in December 2025.

Upgrade through staging and compatibility testing rather than blindly changing runtime versions. Frameworks, Composer packages and plugins also need their own EOL/CVE lifecycle management.

Filesystem, web-server and upload-directory hardening

Grant write access only where required; do not make the entire project 777. Disable script execution in writable upload/cache areas where practical.

Separating web-server, PHP-FPM pool and deployment identities can limit impact. Restrict administrative services with firewall/VPN/IP policies when possible.

How EKA performs a PHP source-code security review

The review covers authentication/authorization, upload flows, input/output handling, database access, filesystem, command execution, secrets, dependencies and server configuration. Static findings are validated against actual application flow.

Controlled negative tests may be used only on an explicitly authorized staging copy to verify that security controls reject unsafe input. The report includes severity, affected endpoint/file, remediation guidance and retest status.

Quick PHP support-status check

General status based on the official PHP support schedule in August 2026. If your distribution vendor backports fixes, also verify that vendor's lifecycle policy.

Select a version.
EKA Web Security Review

Ask the technical team to review

Standard cases are usually scheduled for a 24–72 hour analysis window after pre-assessment. Timing varies with file count, log access, malware spread and application architecture.

Important note: Only test systems you own or are explicitly authorized to assess.

OWASP File Upload Cheat Sheetcheatsheetseries.owasp.orgOWASP XSS Preventioncheatsheetseries.owasp.orgOWASP SQL Injection Preventioncheatsheetseries.owasp.orgOWASP OS Command Injection Defensecheatsheetseries.owasp.orgOWASP CSRF Preventioncheatsheetseries.owasp.orgPHP Supported Versionswww.php.net

Frequently asked questions

Is AI-generated code automatically insecure?

No. It still needs the same secure review and testing discipline before production.

Is blocking only .php enough for uploads?

No. Use layered allowlist, type/signature, filename, storage, authorization and execution controls.

Does PDO automatically prevent SQL injection?

Correct prepared statements are strong protection; unsafe concatenation can still reintroduce risk.

Does CSP completely solve XSS?

No. It is defense in depth; contextual encoding and sanitization are still required.

Is PHP 8.1 still supported?

The official PHP lifecycle shows 8.1 reached EOL on 18 December 2025.

Can code security be assessed without source code?

External review is possible, but source access provides much stronger coverage for code-level issues.

Top