mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix RCE vulnerability in modtcl
Remote attacker could execute arbitrary code embedded into the kick reason while kicking someone on a channel. To mitigate this for existing installations, simply unload the modtcl module for every user, if it's loaded. Note that only users with admin rights can load modtcl at all. While at it, also escape the channel name. Discovered by Johannes Kuhn (DasBrain) Patch by https://github.com/glguy CVE-2024-39844
This commit is contained in:
@@ -248,8 +248,9 @@ class CModTcl : public CModule {
|
||||
// chan specific
|
||||
unsigned int nLength = vChans.size();
|
||||
for (unsigned int n = 0; n < nLength; n++) {
|
||||
CString sChannel = TclEscape(CString(vChans[n]->GetName()));
|
||||
sCommand = "Binds::ProcessNick {" + sOldNick + "} {" + sHost +
|
||||
"} - {" + vChans[n]->GetName() + "} {" + sNewNickTmp +
|
||||
"} - {" + sChannel + "} {" + sNewNickTmp +
|
||||
"}";
|
||||
int i = Tcl_Eval(interp, sCommand.c_str());
|
||||
if (i != TCL_OK) {
|
||||
@@ -260,14 +261,16 @@ class CModTcl : public CModule {
|
||||
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel,
|
||||
const CString& sMessage) override {
|
||||
CString sMes = TclEscape(sMessage);
|
||||
CString sOpNick = TclEscape(CString(OpNick.GetNick()));
|
||||
CString sNick = TclEscape(sKickedNick);
|
||||
CString sOpHost =
|
||||
TclEscape(CString(OpNick.GetIdent() + "@" + OpNick.GetHost()));
|
||||
CString sChannel = TclEscape(Channel.GetName());
|
||||
|
||||
CString sCommand = "Binds::ProcessKick {" + sOpNick + "} {" + sOpHost +
|
||||
"} - {" + Channel.GetName() + "} {" + sNick + "} {" +
|
||||
sMessage + "}";
|
||||
"} - {" + sChannel + "} {" + sNick + "} {" +
|
||||
sMes + "}";
|
||||
int i = Tcl_Eval(interp, sCommand.c_str());
|
||||
if (i != TCL_OK) {
|
||||
PutModule(Tcl_GetStringResult(interp));
|
||||
|
||||
Reference in New Issue
Block a user