CVE-2026-12423: provisioning token validation changes breaks some workflows

Hello,

last week we pushed an update 3.19.2 which contained a fix for CVE-2026-12423. It was reported that provisioning tokens are not validated correctly and attacker can get access to (hashed) root passwords, or other sensitive data stored in Foreman inventory and rendered via templates. Due to various reasons, I jumped on the issue late and did a quick patch that broke some non-standard provisioning workflows.

This thread is my explanation of what happened and ask for a feedback on this. I would like to solve this the next week once we come to a good solution.

Foreman uses several ways on how to pair the incoming requests for unattended template calls:

  • Token. These are UUIDs generated randomly when a host enters a build mode. These are unique enough piece of information that can be used to pair the incoming requests nicely without relying on other methods.
  • IP. When token is not available (disabled, or the workflow cannot use it), then Foreman tries to find the host by its IP (TCP HTTP remote IP) and it respects HTTP proxy forwarding header as well. This is useful for OS installers which cannot use arbitrary HTTP parameters.
  • MAC. For some workflows, specifically iPXE and some bootdisks, mac HTTP parameter is passed and this is matched against Foreman NIC inventory the similar way as IP is done.

The change

After the update, all the unattended requests require token to be present, this breaks:

  • Generic bootdisk (needs MAC)
  • Generic subnet bootdisk (needs MAC)
  • iPXE (needs MAC)

We informed users to disable tokens in order to continue provisioning. However, this only works in environments with managed DHCP where IP address can be used. The change was rolled out only for Redhat (and compatible) families of OSes, so other OSes (Debian/Ubuntu) currently are not affected by the change. At least not in the stable update.

Now, tokens were never considered to be a way to block or protect the templates, they were merely a way to pair requests. This was my initial concern when I saw the ticket, but in a time crunch I decided to do this enforcement solution. Since I was worried this could break things, I narrowed it down to just Redhat family systems.

Solutions

I have two solutions in mind currently.

The first one is to make token enforcement optional, I already filed a Jira/Redmine/PR for this. The idea is simple: the default value of a newly created global setting (yeah) is to keep users safe and enforce tokens. Advanced users with bootdisk/ipxe can turn this off.

However, now that I think about it, tokens are relatively easy to acquire. Everytime a host is in build mode, PXELinux/Grub/iPXE templates are available for download on TFTP and HTTPBoot smart proxies. While both services do not allow listing of files, an attacker can be guessing MAC addresses freely and this is relatively easy thing to do since MAC address space is small e.g. when hardware vendor is known.

And this is exactly the same problem that was reported, except it was reported on the Foreman endpoint rather than TFTP/HTTPBoot service. For any kind of network provisioning, at least one of the two services must be enabled. For this reason, I am thinking if it is not better simply to revert the token enforcement patch completely and document the security limitations.

Opinions?

From my point of view, token enforcement itself sounds perfectly reasonable - since it removes a trivial way for unintended people to retrieve the provisioning template if they know a machine’s MAC address. (As they now also need to know the generated build token)
But since the token has to be provided to the machine under build, there’s a limitation in how far enforcement can be taken, since pre-boot environments are extremely limited.

Perhaps a more secure solution would be to split the current build token concept into two separate ones;

  • A stage 1 token, which only allows rendering the main provisioning template once - and is then considered spent. Which would be suitable for providing through PXE/etc.
  • A stage 2 token, which is valid for the entire length of the build, and is only provided through baking it into a rendered provisioning template - and which is otherwise identical to a current build token.

That would reduce the potential surface for retrieving secrets, as the publicly readable stage 1 token will only be usable up until the machine under build has booted and retrieved its provisioning template, and if another user were to use it then it’d be extremely obvious that such a thing has happened.

But what if something in stage 2 goes wrong? On the next try stage 1 token would be gone and you would need to leave and re-enter build mode. Should happen not very often after you found the way how to provision in your environment, but could make the first user experience worse.

Don’t get me wrong I would be happy with both option, documentation of a limitation or improve security both is fine as long as we make it not over-complicated or loose too much functionality.

Yeah, the downside would be an added annoyance on build failures.

Perhaps such a solution could be done by keeping the current token system exactly as-is, and also generating an additional single-use token next to it.
Then a user could opt-in to the added security by changing which token they use in their PXE templates.

I am currently struggling, if there is a use case where we only authenticate the provisioning token and also have to rely that it is enough to authenticate the host (spoiler-alert: it is Case 3 :wink: )
I know of the following use-cases:

Case 1: NetBased, Foreman manages DHCP, TFTP

  1. Host boots from network and receives a personalized boot-menu from TFTP via DHCP-entry based on the Host’s MAC-address
  2. The boot-menu transfers the provisioning-URL (usually including a provisioning token)
  3. If no provisioning token is used, then Foreman will check IP-/MAC-address to determine which provisioning-script needs to be transmitted

This can be attacked, if the network/DHCP-server is not ‘secure’. Meaning attackers can spoof MAC-addresses, thus receive boot-menus (1.) or provisioning-scripts(3.) not intended for them.
IMHO it does not make a difference here, if the provisioning token is used in step 3. or not. Because you can attack step 1. and thus receive the provisioning token.

Case 2: NetBased, Foreman does not manage DHCP, TFTP

If that is a valid use case, then Foreman has to know IP-/MAC-address of the Host to be installed in advance, in order to deliver the correct provisioning-script to a Host that asks for it.
The Host won’t be able to present a provisioning token, because it cannot be transferred to the Host before it requests it.

Case 3: Bootdisk: Image is specifically customized for the new Host

The boot-menu is bundled into the boot-image, including the customized provisioning-URL.
This is the case where we could rely on only the provisioning token, when Foreman receives the request for the provisioning script. This is because we can assume the customized boot-image is transferred through a secure channel, e.g. the API of a Hypervisor (or a physical medium plugged into the Host).
IP-/MAC-address can be verified as well, if Foreman knows it in advance.

Case 4: Bootdisk: Generic Image

Bootdisk bundles a generalized boot-menu and Foreman decides based on IP-/MAC-address which provisioning-script to deliver to the requesting Host.
So here we rely on IP-/MAC-address and therefore also on secured network/DHCP-server.

What now?

These are the cases I can think of in my head (and had to write down to better think about). Feel free to correct any misconceptions I have :sweat_smile:

In Case 1 and 2 enforcing the token does not add any security in addition to verifying IP-/MAC-address. This is because if the network is not controlled and secured, an attacker is able to receive the boot-menu entries including the provisioning-URL.

Case 4 can only rely on IP-/MAC-address authentication, because there is no way to transfer the token in the first place.

Case 3 is the only legitimate scenario where the token can be the only method of authentication for a request to the provisioning-URL.
That does not mean authentication via IP-/MAC-address cannot be used, but it might be a use-case to explicitly not use it due to less secure network architecture.

So where does that leave us:
I guess I do vote for having a Setting to switch on token enforcement since there is a legitimate use-case where it adds security albeit in a very specific use-case (Case 3 with potentially insecure network-environment).

The only issue I see is the documentation of when to set it and when to not set it. If Case 2 and 4 are the only ones that will break with token enforcement on, then we should think about some kind of warning that is shown, if that combination is used.

I agree, I also think this is the only workflow.

Since I had a chance to think about this more over the weekend, I have one additional proposal.

The window for collecting sensitive data for provisioned hosts is short, only few minutes when hosts are in build mode (assuming that access_unattended_without_build setting is set to false, which is by default). The same data can be also collected both from TFTP and HTTPBoot services (get a token first, then fetch the provisioning template).

For this reason, I suggest to revert the change and document, how to implement an additional level of protection for attacks during the open window using requests per minute per IP limits. There are multiple tools that can achieve that:

  • Apache httpd modules mod_evasive/mod_security (not in RHEL)
  • HAProxy
  • Nginx
  • firewalld
  • fail2ban (not in RHEL)

We would not implement such restrictive policy in the installer, because I do not want us to make the deployment more complex (nginx/haproxy), or too restrictive (firewalld) so this would be only documentation only change.

It should be possible to implement a small feature in Foreman that would use PostgreSQL to track amount of requests per IP and limit access to the resource. We would need to do the same thing for HTTPBoot Smart Proxy (in-memory). I do not think this is worth it.

I have an update and the final proposal. I just found we already have an existing failed_login_attempts_limit brute-force protection for the login page using Rails Cache (Redis/Valkey).

This allows us to revert the enforcement patch and replace it with very similar and simple approach: new setting with 300 allowed requests per 5 minutes for unattended calls. The implementation will be few lines + new class similar to foreman/app/services/foreman/bruteforce_protection.rb at develop · theforeman/foreman · GitHub

This would be part of the next update (errata). Then separately, we can also close the attack window via HTTPBoot Smart Proxy with a similar manner (there is no Redis but smart proxies are single instance - shared memory is enough). Of course, TFTP users cannot be protected - they have to disable TFTP completely.

The bruteforce protection sounds as the best solution, avoiding yet another provisioning setting. And I like reusing what we already have, instead of making the setup more complex. I’d give bonus points for good default so we don’t introduce “failed_provisioning_attempts_limit” setting :slight_smile:

The only problem with sharing the setting is that for login we have a very tight setting of 30 attempts in 5 minutes. For unattended, I would like to go with something more relaxed like 300 in 5 minutes because if customers do have some HTTP proxies, then all hosts might be identified under one IP and concurrent provisioning might have issues with just 30.

So to achieve what you want, we would need to:

  • Rename existing setting, the current name failed_login_attempts_limit is misleading
  • Also update description to reflect its new functionality

This would mean a migration which we cannot do in a security errata. While I share the sentiment about avoiding new global settings, this is not one of these “creates new branch in the codebase” anymore.

Just an idea, which would probably over-complicate things:

Would it make sense to make the number of failed attempts dynamic based on the current number of Hosts in build-mode?

Sounds like a good idea @m-bucher

Additionally, I think 300 attemps in 5 minutes for the same IP is to high. Yes, maybe the requests are from a proxy for certain users - then they can increment the value

I would use something like 20 requests in 5 minutes - as said, its from the same ip. If everything works, there are about 1-5 requests during provisioing for a single host.

Sorry I misled you there. I didn’t mean to share the setting. I meant share the code and set reasonable default for provisioning limits, so we don’t need a setting for that at all. The code may need to be adjusted, since now it’s written puerly for login, but majority of the logic is the same.

We can share the code, sure. The initial patch does not share anything for practical (cherry-picking) reasons. The code is literally 10 lines so no issues here.

But I really think we need this setting to be configurable - I can imagine users doing provisioning over some weird VPN/Proxy setups where REMOTE_IP is always the same and does not send X-Forwarded-For and in that case it could be limiting factor. If you really do not want a new global setting, we could have an environment variable for that but since there is prior art I thought a new setting is fine.

As I said in the PR, I am open for follow-ups but for the initial implementation I would like to keep this simple. Having said that, I am not so sure about doing relatively expensive SELECT COUNT database call just to calculate the base number, we could cache this as well perhaps.

I do not want to break the existing users just by applying update. The 300 number is not a wild guess, I actually carefully considered the math here. I do not want to be pasting walls of LLM text, but 300 requests in 5 minutes is 60 r/min or 1 r/s. An attacker can go through the whole MAC namespace in 18 hours.

With the suggested 20 req/5min that would be 11 hours I do think this does not improve security for a host that sits in a build mode for about an hour. This is why I went for little bit relaxed number which still gives a great security and there is no practical reason to go for lower defaults than 1 r/s.

We implemented and tested brute-force protection for unattended as well as userdata endpoints. It works the similar way as UI login protection. The PR has ACK and awaiting admin merge (we need separate commits for backporting). Thanks for the help here.

The PR was merged, I will go ahead and ask you guys to close the several followup PRs once I dig through my PR inbox. Apologies, and thanks again!