Skip to content

Authenticated Unrestricted File Write in letter.php #1213

Open
@prodigysml

Description

@prodigysml

The Issue

Unrestricted file write vulnerabilities allow attackers to write file such as PHP files, in locations where the web server user has access to write. This may allow an attacker to write files with malicious content and may lead to remote code execution.

An attacker must be authenticated to perform this attack.

Where the Issue Occurred

The following code snippet displays the usage of the fopen function in PHP within the lh-ehr application:

$fh = fopen("$template_dir/".$_POST['newtemplatename'], 'w');

This creates or overwrites a file that the web server user has access to. The following code snippet displays writing user controlled content within the user controlled file:

if (! fwrite($fh, $temp_bodytext)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Web SecurityWhite Hat Reports, Cross Site SQL Injection, etc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions