Skip to content

Commit

Permalink
Release 3.0.4. Security release for CVE-2019-3465
Browse files Browse the repository at this point in the history
  • Loading branch information
robrichards committed Nov 5, 2019
1 parent 0f54660 commit 0a53d3c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
xmlseclibs.php
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??, ??? 2018, 3.0.4-dev
06, Nov 2019, 3.0.4
Security Improvements:
- Insure only a single SignedInfo element exists within a signature during
verification. Refs CVE-2019-3465.
Bug Fixes:
- Fix variable casing.

15, Nov 2018, 3.0.3
Bug Fixes:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2007-2018, Robert Richards <rrichards@cdatazone.org>.
Copyright (c) 2007-2019, Robert Richards <rrichards@cdatazone.org>.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
14 changes: 11 additions & 3 deletions src/XMLSecurityDSig.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ public function locateSignature($objDoc, $pos=0)
$query = ".//secdsig:Signature";
$nodeset = $xpath->query($query, $objDoc);
$this->sigNode = $nodeset->item($pos);
$query = "./secdsig:SignedInfo";
$nodeset = $xpath->query($query, $this->sigNode);
if ($nodeset->length > 1) {
throw new Exception("Invalid structure - Too many SignedInfo elements found");
}
return $this->sigNode;
}
return null;
Expand Down Expand Up @@ -303,6 +308,9 @@ public function canonicalizeSignedInfo()
$xpath = $this->getXPathObj();
$query = "./secdsig:SignedInfo";
$nodeset = $xpath->query($query, $this->sigNode);
if ($nodeset->length > 1) {
throw new Exception("Invalid structure - Too many SignedInfo elements found");
}
if ($signInfoNode = $nodeset->item(0)) {
$query = "./secdsig:CanonicalizationMethod";
$nodeset = $xpath->query($query, $signInfoNode);
Expand Down Expand Up @@ -440,7 +448,7 @@ public function processTransforms($refNode, $objData, $includeCommentNodes = tru
if ($node->localName == 'XPath') {
$arXPath = array();
$arXPath['query'] = '(.//. | .//@* | .//namespace::*)['.$node->nodeValue.']';
$arXpath['namespaces'] = array();
$arXPath['namespaces'] = array();
$nslist = $xpath->query('./namespace::*', $node);
foreach ($nslist AS $nsnode) {
if ($nsnode->localName != "xml") {
Expand Down Expand Up @@ -554,7 +562,7 @@ public function getRefIDs()
$refids = array();

$xpath = $this->getXPathObj();
$query = "./secdsig:SignedInfo/secdsig:Reference";
$query = "./secdsig:SignedInfo[1]/secdsig:Reference";
$nodeset = $xpath->query($query, $this->sigNode);
if ($nodeset->length == 0) {
throw new Exception("Reference nodes not found");
Expand All @@ -578,7 +586,7 @@ public function validateReference()
}
}
$xpath = $this->getXPathObj();
$query = "./secdsig:SignedInfo/secdsig:Reference";
$query = "./secdsig:SignedInfo[1]/secdsig:Reference";
$nodeset = $xpath->query($query, $this->sigNode);
if ($nodeset->length == 0) {
throw new Exception("Reference nodes not found");
Expand Down
2 changes: 1 addition & 1 deletion xmlseclibs.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @author Robert Richards <rrichards@cdatazone.org>
* @copyright 2007-2019 Robert Richards <rrichards@cdatazone.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version 3.0.4-dev
* @version 3.0.4
*/

$xmlseclibs_srcdir = dirname(__FILE__) . '/src/';
Expand Down

0 comments on commit 0a53d3c

Please # to comment.