CVE-2017-14922 (published 2017-09-30T01:29Z)

Stored XSS vulnerability via IMG element at "History" of Profile, Calendar, Tasks, and CRM in Tine 2.0 Community Edition before 2017.08.4 allows an authenticated user to inject JavaScript, which is mishandled during rendering by the application administrator and other users.

Severity: LOW
CVSS v2 base score: 3.5 (AV:N/AC:M/Au:S/C:N/I:P/A:N)
CVSS v3 base score: 5.4, MEDIUM (CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N)

Weakness information:
cwe_id: CWE-79
cwe_name: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
extended_description: 
            Cross-site scripting (XSS) vulnerabilities occur when:
            
               Untrusted data enters a web application, typically from a web request.
               The web application dynamically generates a web page that contains this untrusted data.
               During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
               A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
               Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
               This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
            
            There are three main kinds of XSS:
            
               
                  Type 1: Reflected XSS (or Non-Persistent) - 
         			The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
               
                  Type 2: Stored XSS (or Persistent) - 
               The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
            
               
                  Type 0: DOM-Based XSS - 
               In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
            
            
            Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
            In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
         
         

Fix information:
repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
commit_details: repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
author: Cornelius Weiß
author_date: 2017-09-08 14:25:09+02:00
msg: name might not be displayed correctly

Change-Id: I949c7a80b5356f393d269d3004bd6800772ac63b
Reviewed-on: http://gerrit.tine20.com/customers/5618
Reviewed-by: Cornelius Weiss <c.weiss@metaways.de>
Tested-by: Cornelius Weiss <c.weiss@metaways.de>
repository: repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
repo_name: tine20/tine20
description: Tine 2.0 main repository
repo_language: HTML
owner: tine20
file_changes: filename: ContactGrid.js
change_type: ModificationType.MODIFY
diff: @@ -259,12 +259,12 @@ Tine.Addressbook.ContactGridPanel.contactTypeRenderer = function(data, cell, rec
 
 Tine.Addressbook.ContactGridPanel.displayNameRenderer = function(data) {
     var i18n = Tine.Tinebase.appMgr.get('Addressbook').i18n;
-    return data ? data : ('<div class="renderer_displayNameRenderer_noName">' + i18n._('No name') + '</div>');
+    return data ? Ext.util.Format.htmlEncode(data) : ('<div class="renderer_displayNameRenderer_noName">' + i18n._('No name') + '</div>');
 };
 
 Tine.Addressbook.ContactGridPanel.countryRenderer = function(data) {
     data = Locale.getTranslationData('CountryList', data);
-    return data;
+    return Ext.util.Format.htmlEncode(data);
 };
 
 /**

programming_language: JavaScript
filename: FolderSelectPanel.js
change_type: ModificationType.MODIFY
diff: @@ -123,7 +123,7 @@ Tine.Felamimail.FolderSelectPanel = Ext.extend(Ext.Panel, {
                     allowDrop: false,
                     expanded: false,
                     text: Ext.util.Format.htmlEncode(record.get('name')),
-                    qtip: Tine.Tinebase.common.doubleEncode(record.get('host')),
+                    qtip: Ext.util.Format.htmlEncode(record.get('host')),
                     leaf: false,
                     cls: 'felamimail-node-account',
                     delimiter: record.get('delimiter'),

programming_language: JavaScript
filename: TreePanel.js
change_type: ModificationType.MODIFY
diff: @@ -781,7 +781,7 @@ Ext.extend(Tine.Felamimail.TreePanel, Ext.tree.TreePanel, {
             allowDrop: false,
             expanded: false,
             text: Ext.util.Format.htmlEncode(record.get('name')),
-            qtip: Tine.Tinebase.common.doubleEncode(record.get('host')),
+            qtip: Ext.util.Format.htmlEncode(record.get('host')),
             leaf: false,
             cls: 'felamimail-node-account',
             delimiter: record.get('delimiter'),

programming_language: JavaScript
filename: NodeTreePanel.js
change_type: ModificationType.MODIFY
diff: @@ -253,10 +253,10 @@ Ext.extend(Tine.Filemanager.NodeTreePanel, Tine.widgets.container.TreePanel, {
         if(attr.name && typeof attr.name == 'object') {
             Ext.apply(attr, {
                 text: Ext.util.Format.htmlEncode(attr.name.name),
-                qtip: Tine.Tinebase.common.doubleEncode(attr.name.name)
+                qtip: Ext.util.Format.htmlEncode(attr.name.name)
             });
         }
-        
+
         // copy 'real' data to a node record NOTE: not a full record as we have no record reader here
         var nodeData = Ext.copyTo({}, attr, Tine.Filemanager.Model.Node.getFieldNames());
         attr.nodeRecord = new Tine.Filemanager.Model.Node(nodeData);
@@ -577,13 +577,13 @@ Ext.extend(Tine.Filemanager.NodeTreePanel, Tine.widgets.container.TreePanel, {
         var newNodeRecord = new Tine.Filemanager.Model.Node(nodeData);
         
         var newNode = new Ext.tree.AsyncTreeNode({
-            text: nodeName,
+            text: Ext.util.Format.htmlEncode(nodeName),
             path: nodeData.path,
             name: nodeData.name,
             nodeRecord: newNodeRecord,
             account_grants: nodeData.account_grants,
             id: nodeData.id
-        })
+        });
         
         newNode.attributes.nodeRecord.beginEdit();
         newNode.attributes.nodeRecord.set('path', nodeData.path);

programming_language: JavaScript
filename: PhoneTreePanel.js
change_type: ModificationType.MODIFY
diff: @@ -101,13 +101,13 @@ Tine.Phone.PhoneTreePanel = Ext.extend(Ext.tree.TreePanel, {
         this.store.each(function(record) {
             var label = (record.data.description == '') 
                ? record.data.macaddress 
-               : Ext.util.Format.ellipsis(record.data.description, 30);
+               : Ext.util.Format.ellipsis(Ext.util.Format.htmlEncode(record.data.description), 30);
             var node = new Ext.tree.TreeNode({
                 id: record.id,
                 record: record,
                 text: label,
                 iconCls: 'PhoneIconCls',
-                qtip: Tine.Tinebase.common.doubleEncode(record.data.description),
+                qtip: Ext.util.Format.htmlEncode(record.data.description),
                 leaf: true
             });
             rootNode.appendChild(node);

programming_language: JavaScript
filename: Percentage.js
change_type: ModificationType.MODIFY
diff: @@ -192,7 +192,7 @@ Ext.ux.PercentRendererWithName = function(value, metadata, record) {
             metadata.css = 'x-tinebase-uploadrow';
         }
         
-        return fileName;
+        return Ext.util.Format.htmlEncode(fileName);
     }
     
     if (! Ext.ux.PercentRendererWithName.template) {
@@ -221,7 +221,7 @@ Ext.ux.PercentRendererWithName = function(value, metadata, record) {
     if (typeof value == 'object') {
         fileName = value.name;
     }
-    
+    fileName = Ext.util.Format.htmlEncode(fileName);
     var percent = record.get('progress');
 
     var additionalStyle = '';
@@ -229,7 +229,7 @@ Ext.ux.PercentRendererWithName = function(value, metadata, record) {
         fileName = _('(paused)') + '&#160;&#160;' + fileName;
         additionalStyle = 'background-image: url(\'styles/images/tine20/progress/progress-bg-y.gif\') !important;';
     }
-       
+
     var display = 'width:0px';
     if(percent > -1 && percent < 100) {
         display = '';

programming_language: JavaScript
filename: ActivitiesPanel.js
change_type: ModificationType.MODIFY
diff: @@ -122,6 +122,8 @@ Tine.widgets.activities.ActivitiesTabPanel = Ext.extend(Ext.Panel, {
         var recordClass = Tine.Tinebase.data.RecordMgr.get(this.record_model),
             app = Tine.Tinebase.appMgr.get(this.app);
 
+        note = Ext.util.Format.htmlEncode(note);
+        
         if (recordClass) {
             Ext.each(recordClass.getFieldDefinitions(), function(field) {
                 if (field.label) {

programming_language: JavaScript
filename: TreePanel.js
change_type: ModificationType.MODIFY
diff: @@ -495,12 +495,15 @@ Ext.extend(Tine.widgets.container.TreePanel, Ext.tree.TreePanel, {
         }
         
         Ext.applyIf(attr, {
-            text: Ext.util.Format.htmlEncode(attr.name),
-            qtip: Tine.Tinebase.common.doubleEncode(attr.name),
+            text: attr.name,
+            qtip: attr.name,
             leaf: !!attr.account_grants,
             allowDrop: !!attr.account_grants && attr.account_grants.addGrant
         });
-        
+
+        attr.text = Ext.util.Format.htmlEncode(attr.text);
+        attr.qtip = Ext.util.Format.htmlEncode(attr.qtip);
+
         // copy 'real' data to container space
         attr.container = Ext.copyTo({}, attr, Tine.Tinebase.Model.Container.getFieldNames());
     },

programming_language: JavaScript
filename: FilterPanel.js
change_type: ModificationType.MODIFY
diff: @@ -520,7 +520,7 @@ Ext.extend(Tine.widgets.grid.FilterPanel, Ext.Panel, {
         
         for (var id in this.filterPanels) {
             if (this.filterPanels.hasOwnProperty(id) && this.filterPanels[id].isActive) {
-                filters.push({'condition': 'AND', 'filters': this.filterPanels[id].getValue(), 'id': id, label: this.filterPanels[id].title});
+                filters.push({'condition': 'AND', 'filters': this.filterPanels[id].getValue(), 'id': id, label: Ext.util.Format.htmlDecode(this.filterPanels[id].title)});
             }
         }
         

programming_language: JavaScript
filename: FilterStructureTreePanel.js
change_type: ModificationType.MODIFY
diff: @@ -82,6 +82,9 @@ Tine.widgets.grid.FilterStructureTreePanel = Ext.extend(Ext.tree.TreePanel, {
         this.filterPanel.activeFilterPanel.on('titlechange', this.onFilterPanelTitleChange, this);
         
         this.editor = new Ext.tree.TreeEditor(this);
+        this.editor.on('startedit', function(el, value) {
+            this.editor.setValue(Ext.util.Format.htmlDecode(value));
+        }, this);
         
         Tine.widgets.grid.FilterStructureTreePanel.superclass.initComponent.call(this);
     },
@@ -113,7 +116,7 @@ Tine.widgets.grid.FilterStructureTreePanel = Ext.extend(Ext.tree.TreePanel, {
      */
     onNodeTextChange: function(node, text, oldText) {
         if (node.attributes && node.attributes.filterPanel) {
-            node.attributes.filterPanel.setTitle(text);
+            node.attributes.filterPanel.setTitle(Ext.util.Format.htmlEncode(text));
         }
     },
     

programming_language: JavaScript
filename: PickerPanel.js
change_type: ModificationType.MODIFY
diff: @@ -626,7 +626,7 @@ Tine.widgets.persistentfilter.PickerTreePanelLoader = Ext.extend(Tine.widgets.tr
                     Ext.apply(attr, {
                         isPersistentFilter : isPersistentFilter,
                         text : Ext.util.Format.htmlEncode(this.app.i18n._hidden(attr.name)),
-                        qtip : Tine.Tinebase.common.doubleEncode(attr.description ? this.app.i18n._hidden(attr.description) + ' ' + addText : addText),
+                        qtip : Ext.util.Format.htmlEncode(attr.description ? this.app.i18n._hidden(attr.description) + ' ' + addText : addText),
                         selected : attr.id === this.selectedFilterId,
                         id : attr.id,
 

programming_language: JavaScript
filename: GridRenderer.js
change_type: ModificationType.MODIFY
diff: @@ -60,7 +60,7 @@ Ext.extend(Tine.widgets.relation.GridRenderer, Ext.Component, {
             var el = relations[index];
             if (el.type == this.type && el.related_model == this.relModel) {
                 var record = new this.recordClass(el.related_record);
-                return record.getTitle();
+                return Ext.util.Format.htmlEncode(record.getTitle());
             }
         }
     }

programming_language: JavaScript
filename: ContextMenu.js
change_type: ModificationType.MODIFY
diff: @@ -282,7 +282,7 @@ Tine.widgets.tree.ContextMenu = {
                 title: String.format(_('Rename {0}'), this.nodeName),
                 msg: String.format(_('Please enter the new name of the {0}:'), this.nodeName),
                 buttons: Ext.MessageBox.OKCANCEL,
-                value: node.attributes.longName || node.text,
+                value: Ext.util.Format.htmlDecode(node.attributes.longName || node.text),
                 fn: function(_btn, _text){
                     if (_btn == 'ok') {
                         if (! _text) {
@@ -326,7 +326,7 @@ Tine.widgets.tree.ContextMenu = {
                             success: function(_result, _request){
                             
                                 var nodeData = Ext.util.JSON.decode(_result.responseText);
-                                node.setText(_text);
+                                node.setText(Ext.util.Format.htmlEncode(_text));
                                 
                                 this.scope.fireEvent('containerrename', nodeData, node, _text);
                                                               

programming_language: JavaScript
filename: Loader.js
change_type: ModificationType.MODIFY
diff: @@ -120,7 +120,7 @@ Tine.widgets.tree.Loader = Ext.extend(Ext.tree.TreeLoader, {
             }, this);
 
             node.longName = node.name;
-            node.text = node.name = Ext.util.Format.htmlEncode(containerName);
+            node.text = node.name = containerName;
 
             parentNode.push(node);
         }, this);

programming_language: JavaScript
repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
commit_details: repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
author: Cornelius Weiß
author_date: 2017-09-08 18:41:45+02:00
msg: node exists exception broken

Change-Id: I50370804af4a80cb360542b13df1621430a6e022
repository: repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
repo_name: tine20/tine20
description: Tine 2.0 main repository
repo_language: HTML
owner: tine20
file_changes: filename: MainScreenCenterPanel.js
change_type: ModificationType.MODIFY
diff: @@ -1547,7 +1547,7 @@ Tine.Calendar.MainScreenCenterPanel = Ext.extend(Ext.Panel, {
                         eventInfo = Date.parseDate(fbInfo.dtstart, Date.patterns.ISO8601Long).format(dateFormat + ' ' + format) + ' - ' + Date.parseDate(fbInfo.dtend, Date.patterns.ISO8601Long).format(format);
                     }
                     if (fbInfo.event && fbInfo.event.summary) {
-                        eventInfo += ' : ' + fbInfo.event.summary;
+                        eventInfo += ' : ' + Ext.util.Format.htmlEncode(fbInfo.event.summary);
                     }
                     if (fbInfo.type == 'BUSY_UNAVAILABLE') {
                         denyIgnore = true;

programming_language: JavaScript
filename: ExceptionHandler.js
change_type: ModificationType.MODIFY
diff: @@ -43,7 +43,7 @@ Tine.Filemanager.handleRequestException = function(exception, request) {
 
                 if (exception.existingnodesinfo) {
                     for (i = 0; i < exception.existingnodesinfo.length; i++) {
-                        existingFilenames.push(exception.existingnodesinfo[i].name);
+                        existingFilenames.push(Ext.util.Format.htmlEncode(exception.existingnodesinfo[i].name));
                     }
                 }
 

programming_language: JavaScript
filename: GridContextMenu.js
change_type: ModificationType.MODIFY
diff: @@ -125,15 +125,11 @@ Tine.Filemanager.GridContextMenu = {
             if(nodes && nodes.length) {
                 for(var i=0; i<nodes.length; i++) {
                     var currNodeData = nodes[i].data;
-                    
-                    if(typeof currNodeData.name == 'object') {
-                        nodeName += currNodeData.name.name + '<br />';
-                    }
-                    else {
-                        nodeName += currNodeData.name + '<br />';
-                    }
+
+                    nodeName += Ext.util.Format.htmlEncode(typeof currNodeData.name == 'object' ?
+                        currNodeData.name.name :
+                        currNodeData.name) + '<br />';
                 }
-                
             }
             
             this.conflictConfirmWin = Tine.widgets.dialog.FileListDialog.openWindow({

programming_language: JavaScript
filename: NodeGridPanel.js
change_type: ModificationType.MODIFY
diff: @@ -571,13 +571,10 @@ Tine.Filemanager.NodeGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
         if(nodes && nodes.length) {
             for(var i=0; i<nodes.length; i++) {
                 var currNodeData = nodes[i].data;
-                
-                if(typeof currNodeData.name == 'object') {
-                    nodeName += currNodeData.name.name + '<br />';
-                }
-                else {
-                    nodeName += currNodeData.name + '<br />';
-                }
+
+                nodeName += Ext.util.Format.htmlEncode(typeof currNodeData.name == 'object' ?
+                    currNodeData.name.name :
+                    currNodeData.name) + '<br />';
             }
         }
         

programming_language: JavaScript
filename: MainMenu.js
change_type: ModificationType.MODIFY
diff: @@ -63,7 +63,7 @@ Tine.Tinebase.MainMenu = Ext.extend(Ext.Toolbar, {
         // TODO add a bigger spacer here?
         { xtype: 'spacer' },
         {
-            text: String.format(i18n._('User: {0}'), Tine.Tinebase.registry.get('currentAccount').accountDisplayName),
+            text: Ext.util.Format.htmlEncode(String.format(i18n._('User: {0}'), Tine.Tinebase.registry.get('currentAccount').accountDisplayName)),
             menu: this.getUserActions(),
             menuAlign: 'tr-br',
             iconCls: Tine.Tinebase.registry.get('userAccountChanged') ? 'renderer_accountUserChangedIcon' : 'renderer_accountUserIcon'

programming_language: JavaScript
repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
commit_details: repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
author: Cornelius Weiß
author_date: 2017-09-08 18:24:32+02:00
msg: node delte might fail

Change-Id: Ifa3694efacc0e0ac71792b0d67999c946b4f4712
repository: repo_url: https://github.com/tine20/Tine-2.0-Open-Source-Groupware-and-CRM
repo_name: tine20/tine20
description: Tine 2.0 main repository
repo_language: HTML
owner: tine20
file_changes: filename: NodeEditDialog.js
change_type: ModificationType.MODIFY
diff: @@ -193,6 +193,7 @@ Tine.Filemanager.NodeEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
                                     name: 'path',
                                     hideLabel: true,
                                     fieldClass: 'x-ux-displayfield-text',
+                                    htmlEncode: true,
                                     columnWidth: 1
                                 }],[
                                 Tine.widgets.form.RecordPickerManager.get('Addressbook', 'Contact', {

programming_language: JavaScript
filename: nodeActions.js
change_type: ModificationType.MODIFY
diff: @@ -202,13 +202,9 @@ Tine.Filemanager.nodeActions.Delete = {
         if (nodes && nodes.length) {
             for (var i = 0; i < nodes.length; i++) {
                 var currNodeData = nodes[i].data;
-
-                if (typeof currNodeData.name == 'object') {
-                    nodeName += currNodeData.name.name + '<br />';
-                }
-                else {
-                    nodeName += currNodeData.name + '<br />';
-                }
+                nodeName += Tine.Tinebase.EncodingHelper.encode(typeof currNodeData.name == 'object' ?
+                    currNodeData.name.name :
+                    currNodeData.name) + '<br />';
             }
         }
 

programming_language: JavaScript
filename: TreePanel.js
change_type: ModificationType.MODIFY
diff: @@ -595,12 +595,15 @@ Ext.extend(Tine.widgets.container.TreePanel, Ext.tree.TreePanel, {
         }
 
         Ext.applyIf(attr, {
-            text: Ext.util.Format.htmlEncode(attr.name),
-            qtip: Tine.Tinebase.common.doubleEncode(attr.name),
+            text: attr.name,
+            qtip: attr.name,
             leaf: !!attr.account_grants,
             allowDrop: !!attr.account_grants && attr.account_grants.addGrant
         });
 
+        attr.text = Tine.Tinebase.EncodingHelper.encode(attr.text);
+        attr.qtip = Tine.Tinebase.EncodingHelper.encode(attr.qtip);
+
         // copy 'real' data to container space
         attr.container = Ext.copyTo({}, attr, Tine.Tinebase.Model.Container.getFieldNames());
     },

programming_language: JavaScript