HackerSecurity

Security Reserach: Chocolatey C4B Server

By 6. October 2026October 8th, 2026No Comments

Chocolatey for Business is the backbone of software management in many Windows environments. But what happens when an already managed client is compromised? That is the question we set out to answer.

From Hands-On Experience to the Attacker’s Perspective

The best security research projects often emerge where deep system knowledge meets a consistent attacker mindset. That was exactly the starting point here.

One of the authors brought years of operational experience with Chocolatey for Business environments: planning, deployment, and production operations. The system’s internal communication channels, trust relationships, and management processes were therefore already well understood. The second author contributed the perspective of a security researcher.

We wanted to examine Chocolatey Central Management (CCM) from the point of view of different attackers.

What Is Chocolatey for Business

Chocolatey for Business (C4B) is a platform for centralized software distribution in Windows environments. From a single central location, IT decides which software ends up on which company machines, rolls it out automatically, and keeps it up to date, without having to touch each machine individually.

The machines to be managed are connected to the central management system and then appear together in the dashboard. From that point on, the system knows every machine and its current software inventory.

The company defines which software is approved and may be distributed at all. This curated selection forms the internal catalog from which deployments are later rolled out.

From the dashboard, administrators determine which software should go to which machines or machine groups and trigger the distribution with just a few clicks. Installation then runs automatically on the target systems.

Updates are distributed centrally in the same way. At the same time, the dashboard shows at any moment which software is installed on which machines and where updates are missing.

Beyond these four steps, C4B covers the entire software lifecycle. Programs that are no longer needed can be removed from machines through the same central channel (deprovisioning). And through a self-service catalog, employees can install approved software themselves as needed, without IT having to handle every single request manually.

C4B represents a single central point that determines which software is installed, executed, and updated on all of a company’s Windows machines. What makes C4B so valuable for IT also makes it a valuable target. Whoever controls this central point ultimately controls the entire fleet.

For a security researcher, this is exactly where things get interesting.

A Look Under the Hood

To assess where an attacker might strike, the bird’s-eye view from the previous section is no longer sufficient. We needed to understand what C4B actually consists of under the hood: which components talk to each other, what trust relationships exist between them, and with which privileges they operate. Only this picture allows for sound threat modeling.

C4B is not a single program but an interplay of a few components on three layers:

  • The core controls the distribution and executes it.
  • The required environment provides the packages.
  • The optional automation maintains the package inventory.

We will go through them from the inside out, from the heart of the system to its edges.

The Core: Chocolatey Central Management (CCM)

Chocolatey Central Management is the central management console and the heart of C4B. Through CCM, an administrator sees the entire machine fleet from a single interface and assigns which software should go to which machines. Under the hood, CCM consists of three interacting components:

  • A web interface through which the administrator works.
  • A service that the managed machines check in with.
  • A database that records the software and status inventory of each machine.

This is where deployment plans are defined, meaning the instructions specifying what should be installed or executed on which machines. CCM does not access the machines itself. Instead, it issues the order and leaves the execution to a local component on the target system.

The Core on the Devices: The Agent

This local component is the Chocolatey Agent, a service that runs on every managed machine. It regularly checks with CCM whether a new job is available and executes it as soon as one arrives.

Two properties make it a critical point in the chain. First, it runs with local administrator privileges, since installing software requires them. Second, what it executes is not limited to plain package installations: a deployment can also run arbitrary PowerShell scripts on the target machine. The agent therefore trusts the orders from the central server and carries them out with the highest privileges on the system. Whoever controls CCM can use this path to execute arbitrary code on every connected machine.

The Required Environment: The Repository

The packages themselves are not stored in CCM but in a repository, a package store from which the clients obtain their software. This role must exist, but it is product-agnostic: C4B does not ship its own repository and can instead be integrated into an existing solution. We followed the official installation guide, which uses Nexus, a widely used repository software. However, software such as Artifactory or even a simple file share could also be used here.

The Optional Automation: The CI Pipeline

That leaves the question of how the packages get into the repository. Software can come from the public Chocolatey Community or from other sources and is transferred to the internal repository before distribution. This supply can be automated by a CI pipeline, a process that regularly imports new or updated packages without manual intervention. This is not mandatory, as C4B can handle this step itself, but the official guide uses Jenkins, a common automation server and that is how we implemented it as well.

Which Attack Did We Want to Demonstrate?

Before the technical analysis began, we asked ourselves who would attack this system, from where, and with what goal. We went through the architecture and collected the conceivable attacker positions, from the outside in and with increasing privileges:

  • External attacker: No access to the corporate network. The only way data enters the system from outside is through packages from the configured sources, i.e. a supply chain attack. We did not find any further exposed attack surface.
  • Internal attacker without a client: An attacker inside the corporate network, but without a compromised endpoint. We scanned all components of the test setup and examined them for vulnerabilities, but found none.
  • Authenticated user with restricted privileges: A valid CCM account without admin rights. This position uncovered something that later became part of our report. As a standalone attacker model, however, it is weak. Why would a low-privileged CCM user of all people be the attacker? This threat only unfolds in combination with a realistic entry point.
  • Compromised client: An endpoint already registered in CCM is taken over. Which trust relationships can be abused from here? This is where we started.

What remains is the compromised client, and for good reason. In our incident response cases, the entry vectors are always the same: phishing, malware, stolen credentials, and misconfigurations. A realistic attacker rarely obtains administrator privileges directly but first lands on an ordinary endpoint. This is exactly what our underlying assumption is based on: assume that a client has already been compromised. The question is what the attacker can achieve from there. This starting point, in which part of the system is already in the attacker’s hands, is called assumed breach.

In the end, a single question was decisive: What would a proof actually demonstrate, and who would it help? The supply chain route would have been conceivable but would have achieved little. The fact that malicious code can be smuggled in through open package sources is a well-known fundamental risk of any software distribution and nothing that Chocolatey could fix in its own product. The compromised client, on the other hand, leads to a question that can be answered and a problem that can be fixed. For us, that is the benchmark of good security research. Exposing issues that can actually be remedied.

A client registered in CCM enjoys implicit trust. The system communicates with it, distributes software to it, and expects feedback from it. But no endpoint is trustworthy just because it is registered in the management system. This led to the question that guided our investigation: Can an attacker who controls such a client turn its trust relationship against the infrastructure, against the core of the system, against CCM?

The Findings

While analyzing the CCM dashboard, we did not come across an isolated programming error but rather a consistent pattern. The frontend treats externally supplied values as if they were code rather than plain text. User-controlled strings are treated as raw HTML throughout the application. This makes it possible to inject HTML into the administrator’s view in many places, a so-called stored HTML injection.

The most effective way to achieve this is via the hostname that a managed client reports to CCM. On the client, the file chocolatey-agent.exe runs as a background process.

In our setup, we took a closer look at this file using dnSpy. Here we found the function GetHostName(), which uses the Microsoft API to determine the hostname of the client on which the software is running. This hostname is then reported to CCM.

We modified this function (so-called binary patching) so that it sends a different string instead of the name.

This string then showed up in the admin console:

Next, we tried injecting a heading (an H1 HTML element).

It then appeared in the admin console as rendered HTML:

This means we can submit HTML as the hostname, which the admin’s browser renders as valid HTML as soon as the corresponding view in the dashboard is opened. Next, we attempted a more complex attack using more extensive HTML.