CVE-2022-4556 (published 2022-12-16T17:15Z)

A vulnerability was found in Alinto SOGo up to 5.7.1 and classified as problematic. Affected by this issue is the function _migrateMailIdentities of the file SoObjects/SOGo/SOGoUserDefaults.m of the component Identity Handler. The manipulation of the argument fullName leads to cross site scripting. The attack may be launched remotely. Upgrading to version 5.8.0 is able to address this issue. The name of the patch is efac49ae91a4a325df9931e78e543f707a0f8e5e. It is recommended to upgrade the affected component. The identifier of this vulnerability is VDB-215960.

CVSS v3 base score: 6.1, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-707
cwe_name: Improper Neutralization
description: The product does not ensure or incorrectly ensures that structured messages or data are well-formed and that certain security properties are met before being read from an upstream component or sent to a downstream component.
extended_description: 
            If a message is malformed, it may cause the message to be incorrectly interpreted.
            Neutralization is an abstract term for any technique that ensures that input (and output) conforms with expectations and is "safe."  This can be done by:
	    
	      checking that the input/output is already "safe" (e.g. validation)
	      transformation of the input/output to be "safe" using techniques such as filtering, encoding/decoding, escaping/unescaping, quoting/unquoting, or canonicalization
	      preventing the input/output from being directly provided by an attacker (e.g. "indirect selection" that maps externally-provided values to internally-controlled values)
	      preventing the input/output from being processed at all
	    
            This weakness typically applies in cases where the product prepares a control message that another process must act on, such as a command or query, and malicious input that was intended as data, can enter the control plane instead. However, this weakness also applies to more general cases where there are not always control implications.
         
         

Fix information:
repo_url: https://github.com/Alinto/sogo
commit_details: repo_url: https://github.com/Alinto/sogo
author: smizrahi
author_date: 2022-11-22 10:54:06+01:00
msg: fix(security): Security fix for WSTG-INPV-02. Add XSS protection on identity fullName. Fixes #5642.
repository: repo_url: https://github.com/Alinto/sogo
repo_name: Alinto/sogo
description: SOGo is a very fast and scalable modern collaboration suite (groupware). It offers calendaring, address book management, and a full-featured Webmail client along with resource sharing and permission handling. It also makes use of documented standards (IMAP, CalDAV, CardDAV, etc.) and thereby provides native connectivity (without plugins) to many clients such as Microsoft Outlook, Apple iCal, the iPhone, Mozilla Lightning, and a plethora of mobile devices.
repo_language: Objective-C
owner: Alinto
file_changes: filename: SOGoUserDefaults.m
change_type: ModificationType.MODIFY
diff: @@ -147,7 +147,7 @@ NSString *SOGoPasswordRecoverySecondaryEmail = @"SecondaryEmail";
       rc = NO;
 
       if ([fullName length])
-        [identity setObject: fullName forKey: @"fullName"];
+        [identity setObject: [fullName stringWithoutHTMLInjection: YES] forKey: @"fullName"];
       if ([email length])
         [identity setObject: email forKey: @"email"];
       if ([replyTo length])
@@ -797,7 +797,21 @@ NSString *SOGoPasswordRecoverySecondaryEmail = @"SecondaryEmail";
 
 - (NSArray *) mailIdentities
 {
-  return [self arrayForKey: @"SOGoMailIdentities"];
+  NSMutableArray *mailIdentities;
+  NSMutableDictionary *mailIdentity;
+  NSUInteger i;
+
+  // Remove possible XSS injection
+  mailIdentities = [NSMutableArray arrayWithArray: [self arrayForKey: @"SOGoMailIdentities"]];
+  for (i = 0 ; i < [mailIdentities length] ; i++) {
+    mailIdentity = [mailIdentities objectAtIndex: i];
+    if ([mailIdentity objectForKey: @"fullName"]) {
+      [mailIdentity setObject: [[mailIdentity objectForKey: @"fullName"] stringWithoutHTMLInjection: YES] forKey: @"fullName"];
+      [mailIdentities setObject: mailIdentity atIndexedSubscript: i];
+    }
+  }
+
+  return mailIdentities;
 }
 
 - (void) setMailForceDefaultIdentity: (BOOL) newValue

programming_language: Objective-C