Skip to content

Pluck-4.7.15 admin background exists a remote command execution vulnerability when uploading files #98

@l0ners

Description

@l0ners

I uploaded any file in the "manage files" section, here I uploaded a "1.jpg".

image

Found two files at the upload folder.

image

Looked at the source code for the delete file function. On lines 21 and 22 of "data/in/deletefile.php", the logic is that the file ".htaccess" is not allowed to be deleted. But it can be bypassed.

image

I clicked on the delete button on the page for "1.jpg" and sniffered the packet.

image

Change the value of the request parameter "var" to ".Htaccess" (the suffix name is not case sensitive in Windows)

image

".Htaccess" is already in the trash.

image

The ".htaccess" in the upload folder has been copied to the trash folder.

image

Looked at the source code for the upload function, lines 34 to 52 of "data/in/file.php".

image

The code logic is as follows.

  1. First check if the file suffix is ".htaccess".
  2. then check if the file suffix is in the blacklist.
  3. If the suffix is in the blacklist, add the suffix ".txt" for renaming and give permission.
  4. If the suffix name is not in the blacklist, then give permission directly.

Use race condition for attacks.
First I create a "phpinfo.php" file.
poc:

image

Upload the file and sniffer a packet of the upload request and send it to intruder (add variable a=1 to keep sniffering the request packet).

image

Then sniffer a packet that accesses the file and send it to intruder.

image

Both intruder types are selected as "Numbers" and the number is 10000.

image

Threads are set to 20.
image

Start the attack, when the status of the request to access the file is 200, it means that the file was uploaded successfully and the code was executed.

image

image

Upload webshell with race condition and successfully gain access to the server.
exploit:

image

image

(Note: the ".php" file only exists when the race condition is in place, if the race condition is stopped the ".php" file will still be a ".php.txt" file, so the shell will disconnect. The shell will then disconnect. (So maintaining permissions requires that race condition be maintained at all times)

From: huanyu@tsign.cn

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions