Skip to content
RCE Write-up Advanced

ATutor <= 2.2 (edit_marks.php) PHP Code Injection Vulnerability

The edit_marks.php script in ATutor builds a PHP sort expression from a user-supplied query parameter without proper validation, so an attacker could inject PHP code that runs on the server. This could lead to remote code execution on the affected installation.

karmainsecurity.com

Published on karmainsecurity.com

The vulnerable code is located in the /mods/standard/gradebook/editmarks.php script:

The author, on karmainsecurity.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the order column parameter is only passed through addslashes and then concatenated into a PHP expression that is evaluated, so escaping quotes does not stop code injection.

What the attacker needed

Access to the gradebook edit_marks page

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The application takes a value from the web address and pastes it into a piece of PHP code that it then runs. Because the value is not cleaned properly, someone can put their own PHP instructions there and the server will execute them, which is called code injection.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.