Page MenuHomePhabricator

CVE-2023-29138: Using checkuser api module with bad user name can still break Special:CheckUserLog even after security fixes
Closed, ResolvedPublicSecurity

Description

With T275669: Checkuser stores users to cu_log with trailing spaces, allowing all CUs to turn off Special:CheckuserLog at will (CVE-2021-31553) the problem with bad user input was fixed with a trim(), but using an trailing underscore instead of a trailing space can still break the special page, because the underscore is also invalid at the end or begin on Special:Contributions/<username>_

This should use proper title normalization before storing to the database (Special:CheckUser does that, api module checkuser not).

This can be done also by using the api param type 'user' with the user types 'name', 'ip', 'cidr'

Stack trace is the same as in the linked bug.

Event Timeline

Dreamy_Jazz raised the priority of this task from Medium to High.Jan 29 2023, 10:40 PM

It still breaks Special:CheckUserLog using the API.

Re-adding the security team as once this is +2'd it will need a deploy.

Mstyles subscribed.

Thanks you @Zabe for deploying this patch!

I've refactored the patch following application failure during scap stage-train.

https://sal.toolforge.org/log/BUceUYYB0IdT-khD-sOb

I should clarify. I did not refactor the security patch implementation, only the context so it would apply cleanly.

I should clarify. I did not refactor the security patch implementation, only the context so it would apply cleanly.

Ok, thanks, @dduvall!

Thanks for the refactoring and for the info.

mmartorana renamed this task from Using checkuser api module with bad user name can still break Special:CheckUserLog even after security fixes to CVE-2023-29138: Using checkuser api module with bad user name can still break Special:CheckUserLog even after security fixes.Apr 3 2023, 3:20 PM

I've backported the fix to 1.40, 1.39, 1.38 and 1.35 (based on the Version lifecycle).

One outstanding question is whether the maintenance script to trim the target text is needed to be run again as the fix for the API was only implemented now? Also whether this should be run automatically when running update.php?

mmartorana changed the visibility from "Custom Policy" to "Public (No Login Required)".Apr 4 2023, 7:05 PM