Skip to content

Commit a1a9115

Browse files
Force SASL2+SCRAM for yax.im (already forced for conversations.im)
1 parent 7f5bbcc commit a1a9115

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Monal/Classes/MLXMPPManager.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ -(NSNumber*) login:(NSString*) jid password:(NSString*) password
789789
MLAssert([elements count] > 1, @"Got invalid jid", (@{@"jid": nilWrapper(jid), @"elements": elements}));
790790
NSString* domain = ((NSString*)[elements objectAtIndex:1]).lowercaseString;
791791

792+
//THE FOLLOWING ARE OUTDATED THOUGHTS, WE CURRENTLY WANT TO ALLOW PLAIN AND ONLY BLOCK PLAIN FOR KNOWN PLAIN-OFF SERVERS
792793
//we don't want to set kPlainActivated (not even according to our preload list) and default to plain_activated=false,
793794
//because the error message will warn the user and direct them to the advanced account creation menu to activate PLAIN
794795
//if they still want to connect to this server
@@ -798,7 +799,7 @@ -(NSNumber*) login:(NSString*) jid password:(NSString*) password
798799
//TODO: use preload list and allow PLAIN for all others once enough domains are on this list
799800
//allow plain for all servers not on preload list, since prosody with SASL2 wasn't even released yet
800801
BOOL defaultPlainActivated = YES;
801-
BOOL plainActivated = ([domain isEqualToString:@"yax.im"] || [domain isEqualToString:@"quicksy.im"]) ? YES : defaultPlainActivated;
802+
BOOL plainActivated = ([domain isEqualToString:@"yax.im"] || [domain isEqualToString:@"quicksy.im"] || [domain isEqualToString:@"conversations.im"]) ? NO : defaultPlainActivated;
802803

803804
return [self login:jid password:password hardcodedServer:nil hardcodedPort:nil forceDirectTLS:NO allowPlainAuth:plainActivated];
804805
}

Monal/Classes/OneClickRegistration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ struct OneClickRegistration: View {
110110
kDirectTLS: false,
111111
//creating an account involves transfering the password in cleartext only secured by TLS
112112
//--> logging in directly afterwards using PLAIN doesn't make the situation any worse ==> allow it
113-
//conversations.im already supports sasl2 and scram ## TODO: use SCRAM preload list
113+
//conversations.im and yax.im already support sasl2 and scram ## TODO: use SCRAM preload list
114114
//using the preload list in this case won't solve the situation, but increase the attack cost because
115115
//stripping off SASL2 won't suffice anymore (the attacker will have to use the password sniffed during account creation
116116
//to fake the SCRAM HMAC sent to both client and server)
117-
kPlainActivated: self.actualServer == "conversations.im" ? false : true,
117+
kPlainActivated: !["yax.im", "conversations.im"].contains(self.actualServer),
118118
] as [String : Any]
119119

120120
let accountID = DataLayer.sharedInstance().addAccount(with: dic);

Monal/Classes/RegisterAccount.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ struct RegisterAccount: View {
184184
kDirectTLS: false,
185185
//creating an account involves transfering the password in cleartext only secured by TLS
186186
//--> logging in directly afterwards using PLAIN doesn't make the situation any worse ==> allow it
187-
//conversations.im already supports sasl2 and scram ## TODO: use SCRAM preload list
187+
//conversations.im and yax.im already support sasl2 and scram ## TODO: use SCRAM preload list
188188
//using the preload list in this case won't solve the situation, but increase the attack cost because
189189
//stripping off SASL2 won't suffice anymore (the attacker will have to use the password sniffed during account creation
190190
//to fake the SCRAM HMAC sent to both client and server)
191-
kPlainActivated: self.actualServer == "conversations.im" ? false : true,
191+
kPlainActivated: !["yax.im", "conversations.im"].contains(self.actualServer),
192192
] as [String : Any]
193193

194194
let accountID = DataLayer.sharedInstance().addAccount(with: dic);

Monal/Classes/WelcomeLogIn.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ struct WelcomeLogIn: View {
241241
Text("Allow MITM-prone PLAIN authentication")
242242
}
243243
// TODO: use the SCRAM preload list instead of hardcoding servers
244-
.disabled(["conversations.im"].contains(jidDomainPart.lowercased()))
244+
.disabled(["yax.im", "conversations.im"].contains(jidDomainPart.lowercased()))
245245
.onChange(of: jid) { _ in
246-
if ["conversations.im"].contains(jidDomainPart.lowercased()) {
246+
if ["yax.im", "conversations.im"].contains(jidDomainPart.lowercased()) {
247247
allowPlainAuth = false
248248
}
249249
}

Monal/Classes/XMPPEdit.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ -(IBAction) save:(id) sender
340340
if(self.statusMessage)
341341
[dic setObject:[self.statusMessage stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] forKey:@"statusMessage"];
342342

343-
//conversations.im already supports sasl2 and scram ## TODO: use SCRAM preload list
344-
[dic setObject:([domain.lowercaseString isEqualToString:@"conversations.im"] ? @NO : @(self.plainActivated)) forKey:kPlainActivated];
343+
//conversations.im and yax,im already support sasl2 and scram ## TODO: use SCRAM preload list
344+
[dic setObject:([domain.lowercaseString isEqualToString:@"yax.im"] || [domain.lowercaseString isEqualToString:@"conversations.im"] ? @NO : @(self.plainActivated)) forKey:kPlainActivated];
345345

346346
if(!self.editMode)
347347
{

0 commit comments

Comments
 (0)