mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Address an issue that allows a malicious client to place certificate files in arbitrary directories.
Thanks to David Black (disclosure@d1b.org) for pointing this out.
This commit is contained in:
parent
d5e3722c97
commit
c6150cc198
@ -1,15 +1,15 @@
|
||||
# Copyright (C) 2010 Aldo Cortesi
|
||||
#
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import re, os, subprocess, datetime, urlparse, string
|
||||
import time, functools, cgi, textwrap
|
||||
import time, functools, cgi, textwrap, hashlib
|
||||
import json
|
||||
|
||||
CERT_SLEEP_TIME = 1
|
||||
@ -275,12 +275,13 @@ def dummy_cert(certdir, ca, commonname):
|
||||
|
||||
Returns cert path if operation succeeded, None if not.
|
||||
"""
|
||||
certpath = os.path.join(certdir, commonname + ".pem")
|
||||
namehash = hashlib.sha256(commonname).hexdigest()
|
||||
certpath = os.path.join(certdir, namehash + ".pem")
|
||||
if os.path.exists(certpath):
|
||||
return certpath
|
||||
|
||||
confpath = os.path.join(certdir, commonname + ".cnf")
|
||||
reqpath = os.path.join(certdir, commonname + ".req")
|
||||
confpath = os.path.join(certdir, namehash + ".cnf")
|
||||
reqpath = os.path.join(certdir, namehash + ".req")
|
||||
|
||||
template = open(pkg_data.path("resources/cert.cnf")).read()
|
||||
f = open(confpath, "w")
|
||||
|
6
mitmdump
6
mitmdump
@ -1,17 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (C) 2010 Aldo Cortesi
|
||||
#
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user