问题标签 [pinning]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1160 浏览

apache - 公钥固定不起作用

您好,我正在尝试在我的 apache 服务器上实现 Public-Key-Pinning,该服务器作为另一个 Web 应用程序的代理运行,但它不起作用(如果我输入错误的哈希,页面仍然显示而不是错误,这应该在 Firefox 或 Chrome 中显示)。我确定标题是正确的——哈希是正确的,我已经用 Chrome 测试过了。

我的配置数据是

起初我只有一个哈希值,但我添加了第二个哈希值以防万一。我究竟做错了什么?

注意:当然我已经启用并加载了 mod_header。

0 投票
1 回答
694 浏览

android - Android 操作系统证书固定

我将从一个非常简短的介绍开始,介绍 Android 的操作系统证书固定。从 4.2 版开始,引入了 Android 系统/操作系统级别 SSL/TLS 证书固定(另请参阅此 URL 了解更多信息。)。使用此机制的固定证书列表位于:“/data/misc/keychain/pins”,默认包含大约 40 个 Google 服务条目,如 mail.google.com、youtube.com 等。我非常喜欢通过将其添加到此列表中来固定我自己的证书。但是,修改此列表需要android.permission.WRITE_SECURE_SETTINGS仅对系统应用程序可用的 Android 权限 ( )。

有谁知道谷歌是否可以通过某种程序提交添加到此列表的请求(即/data/misc/keychain/pins)?

0 投票
0 回答
757 浏览

ios - iOS 上的 SSL 固定 - NSURLConnection 的 TLS 缓存问题

在 iOS 应用程序上实现 SSL 证书的固定时遇到了一个问题。我们目前正在使用NSURLConnection委托进行身份验证挑战。这一切都很好,并且在应用程序的初始登录时被调用,确保我们连接到我们的服务器。

我们知道 TLS 缓存,其中固定委托方法 ( w​​illSendRequestForAuthenticationChallenge ) 在 10 分钟内不会再次调用。这实际上不是问题,因为我们只需要在登录时检查证书,尽管更频繁地是可取的。我们向 Apple 提出了支持请求,并收到了确认 TLS 缓存意味着固定委托方法只会定期调用的响应,但加密密钥交换将防止 MITM 代理攻击在调用之间发生。

听起来不错,但情况似乎并非如此。这是我们发现的——如果我们在启动时正常登录我们的应用程序,则会调用 pinning 委托。然后我们在后台运行应用程序并将 iPhone 连接到运行 Burp Suite 的 macbook 上的代理服务器(此时 iPhone 上已经安装了服务器信任证书)。如果我们随后将应用程序置于前台,注销并重新登录,则不会调用 willSendRequestForAuthenticationChallenge,即使此时 TLS 会话应该是无效的。

我尝试在请求上指定不同的缓存策略,但似乎没有什么不同。我不明白为什么在添加 MITM 代理的情况下不会再次调用代表 - 任何建议将不胜感激。

0 投票
1 回答
3639 浏览

ssl - 使用 libcurl 固定 SSL 证书

我想知道这个例子是否足以提供 libcurl 的证书固定:http: //curl.haxx.se/libcurl/c/cacertinmem.html

因为我发现 curl 也允许http://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html

由于我将使用自签名证书并且只信任它,因此我不知道是否真的有必要将其固定。

resume:如果我像示例一样仅将我的证书(自签名)添加到 x509 证书存储区,连接会受到损害吗?我需要添加额外的支票吗?我需要使用 CURLOPT_PINNEDPUBLICKEY 选项吗?

谢谢。

0 投票
1 回答
123 浏览

android - certificate pinning - What happens when rogue developer gets certificate file in Android

In using Certification pinning development is saying that no 3rd party will be trusted with the https certificate, instead it will be stored on the device. If i reverse engineer an android apk, would i not have access to this certificate ? I realize its public but i could use it to do man in the middle attacks, correct ? Where should i put the certificate so that no one can access it ? I have *.cer certificate file located in resources folder in android but need to know how secure it will be there.

0 投票
0 回答
828 浏览

android - 在 onReceivedClientCertRequest 方法中固定 webview 证书

是否可以在 onReceivedClientCertRequest 方法中固定 webview 证书。我想实现类似的东西:

在这个从 webview 客户端覆盖的方法中:

这可能吗,有没有一个很好的例子,因为我在谷歌上找不到?

0 投票
1 回答
651 浏览

android - How avoid man-in-the-middle attack when using Google Cloud Endpoints?

I'm currently writing my first android app and decided to use google cloud endpoints. I have secure my backend endpoints methods by following this docs : https://cloud.google.com/appengine/docs/java/endpoints/auth, https://cloud.google.com/appengine/docs/java/endpoints/gen_clients, https://cloud.google.com/appengine/docs/java/endpoints/consume_android

Basically you have to generate WEB_CLIENT_ID and ANDROID_CLIENT_ID for your endpoints, add a param User on each method you want to secure and finally check inside the method that the user is not null otherwise throw OAuthRequestException.

I have build the client android library and configure it like this in my android app :

At first it seems to work pretty well you cannot use the backend methods without credential. (You will have 401 error)

Unfortunately I notice that it's still possible to decrypt https request/response to backend endpoints if you use a tool like "Charles Proxy" (https://www.charlesproxy.com/). You just have to install charles proxy certificate in your smartphone and configure the proxy.

Here's another description of the same problem: http://nickfishman.com/post/50557873036/reverse-engineering-native-apps-by-intercepting-network

Now you have the endpoints url used by the android app, you've got all the param sent in each request and all the header properties even the autorization property with the token so basically all the informations you need to use my backend endpoints in your app. :( I know the token will expire after a while but in the meantime you can extract my datas.

Google speak about that in the google cloud store doc : https://cloud.google.com/storage/docs/concepts-techniques#bestpractices

"Make sure that you use an HTTPS library that validates server certificates. A lack of server certificate validation makes your application vulnerable to man-in-the-middle attacks or other attacks."

Great but when you use the endpoints client library generated with their tool you are vulnerable too.

I know there are solution to avoid this problem: https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning

But how can I use the generated endpoints client android library and avoid man-in-the-middle attack ?

0 投票
7 回答
34365 浏览

ios - 使用 Swift 和 NSURLSession 固定 iOS 证书

如何在 Swift 中将证书固定添加到 NSURLSession?

OWASP 网站仅包含 Objective-C 和 NSURLConnection 的示例。

0 投票
3 回答
13492 浏览

ssl - SSL Pinning 和证书到期

这个问题与在客户端应用程序中针对 Web api 和证书到期使用 SSL Pinning 有关。

场景

我拥有example.com并有一个托管api的子域,例如:api.example.com

我希望通过SSL使用 api ,因此为子域创建了 SSL 证书。

获得证书后,我有:

  • 公共证书
  • 中级证书
  • 私钥

据我了解,我将这些证书安装在我的网络服务器上。

然后我希望我的客户端应用程序连接到 api。为了减轻中间人攻击,我希望使用 SSL Pinning,这样客户端只会与我的 api 通信,而不是有人欺骗它。

为了固定客户端应用程序,我有两个选择,固定公共证书或中间证书。

假设我实现了这个。

api.example.com上的证书过期时会发生什么?

据我了解,客户端应用程序将不再工作。

我是否需要重新生成一整套公共/中间/私人项目?然后在应用程序中放置一个新的公共或中间证书?

问题

在更新 api.example.com 上的证书之前,我仍然希望客户端应用程序能够正常工作。当然,可以将新证书放入客户端应用程序中,但推出之类的事情需要时间。

我该如何处理?

我读到谷歌每个月都会更新他们的证书,但不知何故设法保持公钥不变:如何在 iOS 上固定证书的公钥

如果这是可能的,那么解决方案是简单地从服务器中提取公钥并根据本地存储的公钥检查它......但谷歌是如何做到的呢?

谢谢

克里斯

0 投票
3 回答
16046 浏览

ios - 在 Alamofire 中固定证书

我正在创建一个访问 HTTPS Web 服务的 iPad 应用程序。我想实施固定,但遇到了问题。

此类创建 Alamofire 管理器(主要取自文档):

此函数进行调用:

证书保存在项目中,并显示在“目标 > 构建阶段 > 复制捆绑资源”下。

我目前每次发出请求时都会收到以下错误(来自 else 块testPinning()):