Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
c5544d28
Kaydet (Commit)
c5544d28
authored
Şub 22, 2016
tarafından
Mark Striemer
Kaydeden (comit)
Tim Graham
Mar 01, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed CVE-2016-2512 -- Prevented spoofing is_safe_url() with basic auth.
This is a security fix.
üst
f4329163
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
2 deletions
+50
-2
http.py
django/utils/http.py
+6
-2
1.8.10.txt
docs/releases/1.8.10.txt
+16
-0
1.9.3.txt
docs/releases/1.9.3.txt
+16
-0
test_http.py
tests/utils_tests/test_http.py
+12
-0
No files found.
django/utils/http.py
Dosyayı görüntüle @
c5544d28
...
@@ -290,8 +290,12 @@ def is_safe_url(url, host=None):
...
@@ -290,8 +290,12 @@ def is_safe_url(url, host=None):
url
=
url
.
strip
()
url
=
url
.
strip
()
if
not
url
:
if
not
url
:
return
False
return
False
# Chrome treats \ completely as /
# Chrome treats \ completely as / in paths but it could be part of some
url
=
url
.
replace
(
'
\\
'
,
'/'
)
# basic auth credentials so we need to check both URLs.
return
_is_safe_url
(
url
,
host
)
and
_is_safe_url
(
url
.
replace
(
'
\\
'
,
'/'
),
host
)
def
_is_safe_url
(
url
,
host
):
# Chrome considers any URL with more than two slashes to be absolute, but
# Chrome considers any URL with more than two slashes to be absolute, but
# urlparse is not so flexible. Treat any url with three slashes as unsafe.
# urlparse is not so flexible. Treat any url with three slashes as unsafe.
if
url
.
startswith
(
'///'
):
if
url
.
startswith
(
'///'
):
...
...
docs/releases/1.8.10.txt
Dosyayı görüntüle @
c5544d28
...
@@ -6,6 +6,22 @@ Django 1.8.10 release notes
...
@@ -6,6 +6,22 @@ Django 1.8.10 release notes
Django 1.8.10 fixes two security issues and several bugs in 1.8.9.
Django 1.8.10 fixes two security issues and several bugs in 1.8.9.
CVE-2016-2512: Malicious redirect and possible XSS attack via user-supplied redirect URLs containing basic auth
===============================================================================================================
Django relies on user input in some cases (e.g.
:func:`django.contrib.auth.views.login` and :doc:`i18n </topics/i18n/index>`)
to redirect the user to an "on success" URL. The security check for these
redirects (namely ``django.utils.http.is_safe_url()``) considered some URLs
with basic authentication credentials "safe" when they shouldn't be.
For example, a URL like ``http://mysite.example.com\@attacker.com`` would be
considered safe if the request's host is ``http://mysite.example.com``, but
redirecting to this URL sends the user to ``attacker.com``.
Also, if a developer relies on ``is_safe_url()`` to provide safe redirect
targets and puts such a URL into a link, they could suffer from an XSS attack.
Bugfixes
Bugfixes
========
========
...
...
docs/releases/1.9.3.txt
Dosyayı görüntüle @
c5544d28
...
@@ -6,6 +6,22 @@ Django 1.9.3 release notes
...
@@ -6,6 +6,22 @@ Django 1.9.3 release notes
Django 1.9.3 fixes two security issues and several bugs in 1.9.2.
Django 1.9.3 fixes two security issues and several bugs in 1.9.2.
CVE-2016-2512: Malicious redirect and possible XSS attack via user-supplied redirect URLs containing basic auth
===============================================================================================================
Django relies on user input in some cases (e.g.
:func:`django.contrib.auth.views.login` and :doc:`i18n </topics/i18n/index>`)
to redirect the user to an "on success" URL. The security check for these
redirects (namely ``django.utils.http.is_safe_url()``) considered some URLs
with basic authentication credentials "safe" when they shouldn't be.
For example, a URL like ``http://mysite.example.com\@attacker.com`` would be
considered safe if the request's host is ``http://mysite.example.com``, but
redirecting to this URL sends the user to ``attacker.com``.
Also, if a developer relies on ``is_safe_url()`` to provide safe redirect
targets and puts such a URL into a link, they could suffer from an XSS attack.
Bugfixes
Bugfixes
========
========
...
...
tests/utils_tests/test_http.py
Dosyayı görüntüle @
c5544d28
...
@@ -97,6 +97,11 @@ class TestUtilsHttp(unittest.TestCase):
...
@@ -97,6 +97,11 @@ class TestUtilsHttp(unittest.TestCase):
'javascript:alert("XSS")'
,
'javascript:alert("XSS")'
,
'
\n
javascript:alert(x)'
,
'
\n
javascript:alert(x)'
,
'
\x08
//example.com'
,
'
\x08
//example.com'
,
r'http://otherserver\@example.com'
,
r'http:\\testserver\@example.com'
,
r'http://testserver\me:pass@example.com'
,
r'http://testserver\@example.com'
,
r'http:\\testserver\confirm\me@example.com'
,
'
\n
'
):
'
\n
'
):
self
.
assertFalse
(
http
.
is_safe_url
(
bad_url
,
host
=
'testserver'
),
"
%
s should be blocked"
%
bad_url
)
self
.
assertFalse
(
http
.
is_safe_url
(
bad_url
,
host
=
'testserver'
),
"
%
s should be blocked"
%
bad_url
)
for
good_url
in
(
'/view/?param=http://example.com'
,
for
good_url
in
(
'/view/?param=http://example.com'
,
...
@@ -106,8 +111,15 @@ class TestUtilsHttp(unittest.TestCase):
...
@@ -106,8 +111,15 @@ class TestUtilsHttp(unittest.TestCase):
'https://testserver/'
,
'https://testserver/'
,
'HTTPS://testserver/'
,
'HTTPS://testserver/'
,
'//testserver/'
,
'//testserver/'
,
'http://testserver/confirm?email=me@example.com'
,
'/url
%20
with
%20
spaces/'
):
'/url
%20
with
%20
spaces/'
):
self
.
assertTrue
(
http
.
is_safe_url
(
good_url
,
host
=
'testserver'
),
"
%
s should be allowed"
%
good_url
)
self
.
assertTrue
(
http
.
is_safe_url
(
good_url
,
host
=
'testserver'
),
"
%
s should be allowed"
%
good_url
)
# Valid basic auth credentials are allowed.
self
.
assertTrue
(
http
.
is_safe_url
(
r'http://user:pass@testserver/'
,
host
=
'user:pass@testserver'
))
# A path without host is allowed.
self
.
assertTrue
(
http
.
is_safe_url
(
'/confirm/me@example.com'
))
# Basic auth without host is not allowed.
self
.
assertFalse
(
http
.
is_safe_url
(
r'http://testserver\@example.com'
))
def
test_urlsafe_base64_roundtrip
(
self
):
def
test_urlsafe_base64_roundtrip
(
self
):
bytestring
=
b
'foo'
bytestring
=
b
'foo'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment