Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit fc3dc50

Browse files
author
Sergey Semenov
committed
MAGETWO-63137: Fix Zend Mail vulnerability
1 parent b4502f3 commit fc3dc50

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/Zend/Mail/Transport/Sendmail.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ protected function _prepareHeaders($headers)
194194
unset($headers['Subject']);
195195
}
196196

197+
// Sanitize the From header
198+
if (isset($headers['From'])) {
199+
$addressList = array_filter($headers['From'], function($key) {
200+
return $key !== 'append';
201+
}, ARRAY_FILTER_USE_KEY);
202+
foreach ($addressList as $address) {
203+
if (preg_match('/\\\"/', $address)) {
204+
throw new Zend_Mail_Transport_Exception('Potential code injection in From header');
205+
}
206+
}
207+
}
208+
197209
// Prepare headers
198210
parent::_prepareHeaders($headers);
199211

0 commit comments

Comments
 (0)