Skip to content
Access control Write-up Intermediate

SQL Server Privilege Escalation From db_ddladmin to sysadmin role

A user with the db_ddladmin role can escalate to sysadmin by exploiting the syspolicy_purge_history job. An attacker could gain full control of the SQL Server instance.

medium.com

Published on medium.com

Microsoft SQL Server is a popular database technology and widely used. Securing your database means ….securing your data.

Emad Al-Mousa, on medium.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 syspolicy_purge_history job runs with higher privileges and can be modified by db_ddladmin members, allowing them to execute arbitrary commands as sysadmin.

What the attacker needed

Db_ddladmin role on SQL Server

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.

In SQL Server, different roles give different levels of permission. The db_ddladmin role lets you change database structure but not manage the whole server. This report shows that someone with that role can use a built-in maintenance job to become a full administrator (sysadmin), which means they can do anything on the database server.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.