Skip to content

Commit

Permalink
BUG Fixed XML injection in DPSAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Mar 4, 2013
1 parent 13761b0 commit 4de9cc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.4.1 - 2013-02-28

* Security: Payment Information Leak in Test Harness Controller (see 0.3.2)
* Security: XML Injection in DPSAdapter API Requests (see 0.3.2)

## 0.3.2 - 2013-02-28

Expand All @@ -28,6 +29,12 @@ In this case, don't forget to flush the manifest cache by appending ?flush=1 to

Reporter: Nicolaas Thiemen-Francken

* Security: XML Injection in DPSAdapter API Requests

The `doPayment()`, `postConnect()` and `doDPSHostedPayment()` methods on `DPSAdapter` did not sanitize
method arguments before constructing an XML request from it, and passing it on to the DPS API.
Since these arguments are typically derived from user input, the method is considered unsafe.

## 0.4.0 - 2013-02-20

* Security: Information Leak in DPSAdapter (see 0.3.1)
Expand Down
10 changes: 7 additions & 3 deletions code/DPSPayment/DPSAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public function postConnect(){
$inputs['PostPassword'] = self::$pxPost_Password;
$transaction = "<Txn>";
foreach($inputs as $name => $value) {
$transaction .= "<$name>$value</$name>";
$XML_name = Convert::raw2xml($name);
$XML_value = Convert::raw2xml($value);
$transaction .= "<$XML_name>$XML_value</$XML_name>";
}
$transaction .= "</Txn>";

Expand All @@ -143,7 +145,9 @@ function doPayment($inputs, $payment) {
if($name == "Amount") {
$value = number_format($value, 2, '.', '');
}
$transaction .= "<$name>$value</$name>";
$XML_name = Convert::raw2xml($name);
$XML_value = Convert::raw2xml($value);
$transaction .= "<$XML_name>$XML_value</$XML_name>";
}
$transaction .= "</Txn>";

Expand Down Expand Up @@ -212,7 +216,7 @@ function doDPSHostedPayment($inputs, $payment) {
$request = new PxPayRequest();
foreach($inputs as $element => $value) {
$funcName = 'set' . $element;
$request->$funcName($value);
$request->$funcName(Convert::raw2xml($value));
}

// submit payment request to get the URL for redirection
Expand Down

0 comments on commit 4de9cc8

Please sign in to comment.