Bug 2568586 - incron: setuid incrontab can change ownership of arbitrary files, enabling local privilege escalation
Summary: incron: setuid incrontab can change ownership of arbitrary files, enabling lo...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: incron
Version: 45
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-11-07 09:11 UTC by Edward Cant
Modified: 2026-11-20 08:10 UTC (History)
1 user (show)

Fixed In Version: incron-0.5.12-31.fc46 incron-0.5.12-31.el10_4 incron-0.5.12-31.el8 incron-0.5.12-31.el9 incron-0.5.12-31.fc43 incron-0.5.12-31.fc45 incron-0.5.12-31.fc44
Clone Of:
Environment:
Last Closed: 2026-11-20 07:00:27 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Edward Cant 2026-11-07 09:11:55 UTC
Overview
========

An unprivileged local user can supply a custom incron configuration to the setuid-root /usr/bin/incrontab program. Although incrontab prints: "insufficient privileges to use custom configuration (will use default)" it does not actually reset the configuration path to the default. It proceeds to load the attacker-controlled configuration.

By making the user-table path a symbolic link to a root-owned file, incrontab follows the link while running with effective UID 0, writes the supplied table through it, and then calls chown() on the resulting path. This gives us an arbitrary root-file overwrite primitive. I demonstrated local privilege escalation by targeting /etc/passwd.

This works on the stock Fedora ISO installed into a qemu VM with the only change being the installation of incron, SELinux was left enabled.

* Fedora release 45 (Forty Five)
* incron-0.5.12-30.fc45.x86_64
* selinux-policy-targeted-45.23-1.fc45.noarch
* selinux-policy-45.23-1.fc45.noarch

Root cause
==========

In ict-main.cpp, the config option is initialized to the system configuration:

    std::string cfg(INCRON_CONFIG);

When -f/--config is supplied, AppArgs::GetOption() replaces cfg with the
attacker-provided path. For a non-root real UID, the code only prints a
warning:

    if (uid != 0) {
        fprintf(stderr,
            "insufficient privileges to use custom configuration "
            "(will use default)\n");
    }

It does not return an error and does not restore cfg to INCRON_CONFIG.
IncronCfg::Load(cfg) consequently loads the attacker-provided file.

The attacker-controlled user_table_dir is later used to construct the output
path in copy_from_file(). The setuid process saves the table to that path and
then performs:

    chown(out.c_str(), ppwd->pw_uid, -1)

Both operations follow a symbolic link placed at the attacker-selected output
path.


Reproducible: Always

Steps to Reproduce:
Reproduction
============

As root

1. Install incron.

As an ordinary user:

1. Create an attacker-owned directory containing a spool directory.
2. Create a custom configuration setting user_table_dir to that spool directory and allowed_users to an attacker-controlled allow file.
3. Add the current username to the allow file.
4. Create a symbolic link named after the current user inside the spool directory, pointing to /etc/passwd.
5. Execute /usr/bin/incrontab -f ATTACKER_CONFIG TABLE_FILE

Despite reporting that the custom configuration cannot be used, incrontab loads it. /etc/passwd is overwritten through the symbolic link and its owner is changed to the attacking user's UID.

---

Details of PoC/steps to reproduce:

mkdir /tmp/repro
mkdir /tmp/repro/spool
ln -s /etc/passwd /tmp/repro/spool/riv

/tmp/repro/config:
user_table_dir = /tmp/repro/spool
allowed_users = /tmp/repro/allow

/tmp/repro/allow:
riv

/tmp/repro/table
riv:x:1001:1001::/home/riv:/bin/bash 1 placeholder

/usr/bin/incrontab -f /tmp/repro/config /tmp/repro/table



Expected Results:
If the software is launched by a low privilege user, it should not be able to overwrite arbitrary files.

Comment 1 Kevin Fenzi 2026-11-07 18:24:51 UTC
Thanks for the report.

At first glance, just adding a 'exit 1' after the warning about the config being passed for a non uid 0 user would prevent this attack?

Comment 2 Edward Cant 2026-11-09 12:29:06 UTC
Yes, I believe that would fix it.

Comment 3 Kevin Fenzi 2026-11-10 22:45:06 UTC
Can you test this scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=152155665

If that looks good I can push out updates.

Do we want to ask for a CVE here? Or just get it updated as soon as possible?

Comment 4 Edward Cant 2026-11-11 07:30:26 UTC
Just tested it out, the scratch build [152155665] did not resolve the issue. The patch (patch 3) was not compiled into it.

I'd appreciate if we can get a CVE number assigned.

Thanks!

Comment 5 Kevin Fenzi 2026-11-11 14:54:13 UTC
Ugh, Sorry about that, this spec needs some modernization. ;( 

Try: 

https://koji.fedoraproject.org/koji/taskinfo?taskID=152171788

Comment 6 Edward Cant 2026-11-11 15:29:19 UTC
Not a problem at all!

That new build is working and has resolved the issue, prints "insufficient privileges to use custom configuration" when I try to do the attack.

Comment 7 Kevin Fenzi 2026-11-11 17:29:35 UTC
Great. I will do builds today for everything... I'm not sure on the CVE part, but we can attach one to the updates when/if we get one.

Comment 8 Fedora Update System 2026-11-12 01:44:55 UTC
FEDORA-2026-3f54d4b3cd (incron-0.5.12-31.fc46) has been submitted as an update to Fedora 46.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-3f54d4b3cd

Comment 9 Fedora Update System 2026-11-12 01:47:53 UTC
FEDORA-2026-3f54d4b3cd (incron-0.5.12-31.fc46) has been pushed to the Fedora 46 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2026-11-12 02:13:25 UTC
FEDORA-2026-db7a3ef92b (incron-0.5.12-31.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-db7a3ef92b

Comment 11 Fedora Update System 2026-11-12 02:13:25 UTC
FEDORA-EPEL-2026-2ffde1f2b7 (incron-0.5.12-31.el10_4) has been submitted as an update to Fedora EPEL 10.4.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-2ffde1f2b7

Comment 12 Fedora Update System 2026-11-12 02:13:26 UTC
FEDORA-2026-93de20052b (incron-0.5.12-31.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-93de20052b

Comment 13 Fedora Update System 2026-11-12 02:13:27 UTC
FEDORA-EPEL-2026-28046962ee (incron-0.5.12-31.el8) has been submitted as an update to Fedora EPEL 8.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-28046962ee

Comment 14 Fedora Update System 2026-11-13 02:06:21 UTC
FEDORA-EPEL-2026-13e46770aa has been pushed to the Fedora EPEL 9 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-13e46770aa

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 15 Fedora Update System 2026-11-13 02:10:31 UTC
FEDORA-EPEL-2026-28046962ee has been pushed to the Fedora EPEL 8 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-28046962ee

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2026-11-13 02:23:51 UTC
FEDORA-2026-93de20052b has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-93de20052b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-93de20052b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Fedora Update System 2026-11-13 02:58:08 UTC
FEDORA-EPEL-2026-2ffde1f2b7 has been pushed to the Fedora EPEL 10.4 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2026-2ffde1f2b7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 18 Fedora Update System 2026-11-13 03:28:23 UTC
FEDORA-2026-db7a3ef92b has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-db7a3ef92b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-db7a3ef92b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 19 Fedora Update System 2026-11-13 03:43:56 UTC
FEDORA-2026-4b67d2e4ac has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-4b67d2e4ac`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-4b67d2e4ac

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 20 Fedora Update System 2026-11-20 07:00:27 UTC
FEDORA-EPEL-2026-2ffde1f2b7 (incron-0.5.12-31.el10_4) has been pushed to the Fedora EPEL 10.4 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 21 Fedora Update System 2026-11-20 07:18:11 UTC
FEDORA-EPEL-2026-28046962ee (incron-0.5.12-31.el8) has been pushed to the Fedora EPEL 8 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 22 Fedora Update System 2026-11-20 07:19:35 UTC
FEDORA-EPEL-2026-13e46770aa (incron-0.5.12-31.el9) has been pushed to the Fedora EPEL 9 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2026-11-20 07:38:34 UTC
FEDORA-2026-db7a3ef92b (incron-0.5.12-31.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 24 Fedora Update System 2026-11-20 07:49:43 UTC
FEDORA-2026-93de20052b (incron-0.5.12-31.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 25 Fedora Update System 2026-11-20 08:10:18 UTC
FEDORA-2026-4b67d2e4ac (incron-0.5.12-31.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.