# CVE-2021-21431: Improper Input Validation in sopel-plugins.channelmgnt

> Attackers can bypass kick/kickban restrictions in the Sopel channel management plugin on certain IRC networks, allowing unauthorized user removal.

- **Severity:** High 7.6 (`CVSS:3.1/AV:A/AC:L/PR:H/UI:R/S:C/C:N/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 9 Apr 2021
- **Updated:** 3 Aug 2024
- **Also known as:** GHSA-23c7-6444-399m, PYSEC-2021-58

## What is CVE-2021-21431?

CVE-2021-21431 is a high-severity vulnerability in MirahezeBots sopel-channelmgnt, published on 9 Apr 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

sopel-channelmgnt is a channelmgnt plugin for sopel. In versions prior to 2.0.1, on some IRC servers, restrictions around the removal of the bot using the kick/kickban command could be bypassed when kicking multiple users at once. We also believe it may have been possible to remove users from other channels but due to the wonder that is IRC and following RfCs, We have no POC for that. Freenode is not affected. This is fixed in version 2.0.1. As a workaround, do not use this plugin on networks where TARGMAX > 1.

Weakness: CWE-284 (Improper Access Control), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2021-21431?

3 open source packages ship an affected version, including sopel-plugins-channelmgnt and sopel-plugins.channelmgnt. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `sopel-plugins-channelmgnt` | PyPI | All versions | 2.0.1 |
| `sopel-plugins-channelmgnt` | PyPI | All versions | 2.0.1 |
| `sopel-plugins.channelmgnt` | PyPI | All versions | 2.0.1 |

Products: Mirahezebots Channelmgnt.

## How do I fix CVE-2021-21431?

Upgrade sopel-plugins-channelmgnt to 2.0.1 or later.

## Is CVE-2021-21431 being exploited?

There is no known exploitation of CVE-2021-21431 in the wild and no public exploit code.

## Other vulnerabilities in MirahezeBots sopel-channelmgnt

- [CVE-2020-15251](https://insights.sbomify.com/CVE-2020-15251/): Privilege Escalation in Channelmgnt plug-in for Sopel (high 7.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-21431 and fix it if it is affected.

What it is: CVE-2021-21431 is a high-severity vulnerability in MirahezeBots sopel-channelmgnt, published on 9 Apr 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2021-21431 in the wild and no public exploit code.

Affected packages and fixed versions:
- sopel-plugins-channelmgnt (PyPI): affected all versions; fixed in 2.0.1
- sopel-plugins-channelmgnt (PyPI): affected all versions; fixed in 2.0.1
- sopel-plugins.channelmgnt (PyPI): affected all versions; fixed in 2.0.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-21431/ (Markdown: https://insights.sbomify.com/CVE-2021-21431/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-21431
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-21431
- OSV: https://osv.dev/vulnerability/CVE-2021-21431

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-21431/
Summaries are generated and may contain mistakes; the official description above is the record.
