OWASP-CM-001

来源:互联网 发布:ps网络课程 编辑:程序博客网 时间:2024/05/02 02:59

Configuration Management Testing 配置管理测试

 

配置管理测试包括:源代码、HTTP准许、认证方法和基础设施的配置等

CM一共有8个测试项。

 

OWASP-CM-001 SSL/TLS测试

 

即使使用高加密口令,一些错误的配置仍然可以导致使用弱口令也可以访问。

Testing SSL / TLS cipher specifications and requirements for site 测试SSL/TLS密码规范和要求。

http的安全实现通常通过SSL/TLS隧道。另外,https还可以使用数字证书。

https选择至多40位的key,这样的长度的密钥可能被突破。即便是SSL也不应该选择弱密码,使得攻击成为可能。

 

 

SSL连接的最初阶段,客户端发送一个Hello信息到服务器端,该密码能够在其他信息中处理。客户端通常是一个网络浏览器(目前最流行的SSL客户端),但不一定,因为它可以是任何SSL功能的应用,对于服务器来说同样,它可能不是一个Web服务器,虽然这是最常见的案例。 (例如,一个值得注意的例子是,SSL客户端是SSL的代理,如stunnelwww.stunnel.org),它使得非SSL允许的工具进行SSL会话。)

Black Box Test and example 黑盒测试示例

为了检测弱密码的可能支持,由SSL/TLS提供的服务所关联的端口必须被确定。通常包括端口443,这是标准HTTPS端口,但是这可能会改变,因为一)https服务可能被配置为运行在非标准端口,和b)可能还有其它的SSL / TLS的相关的网络应用服务。一般来说,一次服务发现的过程需要确定这些端口。

Namp扫描,使用“–sV”扫描选项能识别SSL服务。漏洞扫描,除了实现服务发现,可能包括对弱密码检查(例如,Nessus的扫描仪具有检查的任意端口的SSL服务的能力,并将报告弱密码)

Example 1. SSL service recognition via nmap.

 

[root@test]# nmap -F -sV localhost

Starting nmap 3.75 ( http://www.insecure.org/nmap/ ) at 2005-07-27 14:41 CEST

Interesting ports on localhost.localdomain (127.0.0.1):

(The 1205 ports scanned but not shown below are in state: closed)

 

PORT      STATE SERVICE         VERSION

443/tcp   open  ssl             OpenSSL

901/tcp   open  http            Samba SWAT administration server

8080/tcp  open  http            Apache httpd 2.0.54 ((Unix) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/4.3.11)

8081/tcp  open  http            Apache Tomcat/Coyote JSP engine 1.0

 

Nmap run completed -- 1 IP address (1 host up) scanned in 27.881 seconds

[root@test]#

 

Example 2. Identifying weak ciphers with Nessus. The following is an anonymized excerpt of a report generated by the Nessus scanner, corresponding to the identification of a server certificate allowing weak ciphers (see underlined text).

确定弱密码。以下是由Nessus的扫描仪产生的匿名报告摘录。

 

 https (443/tcp)

 Description

 Here is the SSLv2 server certificate:

 Certificate:

 Data:

 Version: 3 (0x2)

 Serial Number: 1 (0x1)

 Signature Algorithm: md5WithRSAEncryption

 Issuer: C=**, ST=******, L=******, O=******, OU=******, CN=******

 Validity

 Not Before: Oct 17 07:12:16 2002 GMT

 Not After : Oct 16 07:12:16 2004 GMT

 Subject: C=**, ST=******, L=******, O=******, CN=******

 Subject Public Key Info:

 Public Key Algorithm: rsaEncryption

 RSA Public Key: (1024 bit)

 Modulus (1024 bit):

 00:98:4f:24:16:cb:0f:74:e8:9c:55:ce:62:14:4e:

 6b:84:c5:81:43:59:c1:2e:ac:ba:af:92:51:f3:0b:

 ad:e1:4b:22:ba:5a:9a:1e:0f:0b:fb:3d:5d:e6:fc:

 ef:b8:8c:dc:78:28:97:8b:f0:1f:17:9f:69:3f:0e:

 72:51:24:1b:9c:3d:85:52:1d:df:da:5a:b8:2e:d2:

 09:00:76:24:43:bc:08:67:6b:dd:6b:e9:d2:f5:67:

 e1:90:2a:b4:3b:b4:3c:b3:71:4e:88:08:74:b9:a8:

 2d:c4:8c:65:93:08:e6:2f:fd:e0:fa:dc:6d:d7:a2:

 3d:0a:75:26:cf:dc:47:74:29

 Exponent: 65537 (0x10001)

 X509v3 extensions:

 X509v3 Basic Constraints:

 CA:FALSE

 Netscape Comment:

 OpenSSL Generated Certificate

 Page 10

 Network Vulnerability Assessment Report 25.05.2005

 X509v3 Subject Key Identifier:

 10:00:38:4C:45:F0:7C:E4:C6:A7:A4:E2:C9:F0:E4:2B:A8:F9:63:A8

 X509v3 Authority Key Identifier:

 keyid:CE:E5:F9:41:7B:D9:0E:5E:5D:DF:5E:B9:F3:E6:4A:12:19:02:76:CE

 DirName:/C=**/ST=******/L=******/O=******/OU=******/CN=******

 serial:00

 Signature Algorithm: md5WithRSAEncryption

 7b:14:bd:c7:3c:0c:01:8d:69:91:95:46:5c:e6:1e:25:9b:aa:

 8b:f5:0d:de:e3:2e:82:1e:68:be:97:3b:39:4a:83:ae:fd:15:

 2e:50:c8:a7:16:6e:c9:4e:76:cc:fd:69:ae:4f:12:b8:e7:01:

 b6:58:7e:39:d1:fa:8d:49:bd:ff:6b:a8:dd:ae:83:ed:bc:b2:

 40:e3:a5:e0:fd:ae:3f:57:4d:ec:f3:21:34:b1:84:97:06:6f:

 f4:7d:f4:1c:84:cc:bb:1c:1c:e7:7a:7d:2d:e9:49:60:93:12:

 0d:9f:05:8c:8e:f9:cf:e8:9f:fc:15:c0:6e:e2:fe:e5:07:81:

 82:fc

 Here is the list of available SSLv2 ciphers:

 RC4-MD5

 EXP-RC4-MD5

 RC2-CBC-MD5

 EXP-RC2-CBC-MD5

 DES-CBC-MD5

 DES-CBC3-MD5

 RC4-64-MD5

 The SSLv2 server offers 5 strong ciphers, but also 0 medium strength and 2 weak "export   class" ciphers.

 The weak/medium ciphers may be chosen by an export-grade or badly configured client software. They only offer a limited protection against a brute force attack

 Solution: disable those ciphers and upgrade your client software if necessary.

 See http://support.microsoft.com/default.aspx?scid=kben-us216482

 or http://httpd.apache.org/docs-2.0/mod/mod_ssl.html#sslciphersuite

 This SSLv2 server also accepts SSLv3 connections.

 This SSLv2 server also accepts TLSv1 connections.

Example 3. Manually audit weak SSL cipher levels with OpenSSL. The following will attempt to connect to Google.com with SSLv2. 动审计SSLOpenSSL的密水平

 

[root@test]# openssl s_client -no_tls1 -no_ssl3 -connect www.google.com:443

CONNECTED(00000003)

depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com

verify error:num=20:unable to get local issuer certificate

verify return:1

depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com

verify error:num=27:certificate not trusted

verify return:1

depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com

verify error:num=21:unable to verify the first certificate

verify return:1

---

Server certificate

-----BEGIN CERTIFICATE-----

MIIDYzCCAsygAwIBAgIQYFbAC3yUC8RFj9MS7lfBkzANBgkqhkiG9w0BAQQFADCB

zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ

Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE

CxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhh

d3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNl

cnZlckB0aGF3dGUuY29tMB4XDTA2MDQyMTAxMDc0NVoXDTA3MDQyMTAxMDc0NVow

aDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1v

dW50YWluIFZpZXcxEzARBgNVBAoTCkdvb2dsZSBJbmMxFzAVBgNVBAMTDnd3dy5n

b29nbGUuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/e2Vs8U33fRDk

5NNpNgkB1zKw4rqTozmfwty7eTEI8PVH1Bf6nthocQ9d9SgJAI2WOBP4grPj7MqO

dXMTFWGDfiTnwes16G7NZlyh6peT68r7ifrwSsVLisJp6pUf31M5Z3D88b+Yy4PE

D7BJaTxq6NNmP1vYUJeXsGSGrV6FUQIDAQABo4GmMIGjMB0GA1UdJQQWMBQGCCsG

AQUFBwMBBggrBgEFBQcDAjBABgNVHR8EOTA3MDWgM6Axhi9odHRwOi8vY3JsLnRo

YXd0ZS5jb20vVGhhd3RlUHJlbWl1bVNlcnZlckNBLmNybDAyBggrBgEFBQcBAQQm

MCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0ZS5jb20wDAYDVR0TAQH/

BAIwADANBgkqhkiG9w0BAQQFAAOBgQADlTbBdVY6LD1nHWkhTadmzuWq2rWE0KO3

Ay+7EleYWPOo+EST315QLpU6pQgblgobGoI5x/fUg2U8WiYj1I1cbavhX2h1hda3

FJWnB3SiXaiuDTsGxQ267EwCVWD5bCrSWa64ilSJTgiUmzAv0a2W8YHXdG08+nYc

X/dVk5WRTw==

-----END CERTIFICATE-----

subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com

issuer=/C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com

---

No client certificate CA names sent

---

Ciphers common between both SSL endpoints:

RC4-MD5         EXP-RC4-MD5     RC2-CBC-MD5

EXP-RC2-CBC-MD5 DES-CBC-MD5     DES-CBC3-MD5

RC4-64-MD5

---

SSL handshake has read 1023 bytes and written 333 bytes

---

New, SSLv2, Cipher is DES-CBC3-MD5

Server public key is 1024 bit

Compression: NONE

Expansion: NONE

SSL-Session:

    Protocol  : SSLv2

    Cipher    : DES-CBC3-MD5

    Session-ID: 709F48E4D567C70A2E49886E4C697CDE

    Session-ID-ctx:

    Master-Key: 649E68F8CF936E69642286AC40A80F433602E3C36FD288C3

    Key-Arg   : E8CB6FEB9ECF3033

    Start Time: 1156977226

    Timeout   : 300 (sec)

    Verify return code: 21 (unable to verify the first certificate)

---

closed

 

 

White Box Test and example 白盒测试示例

检查提供https服务的web服务器的配置,如果服务器使用了其他的SSL/TLS的服务,也需要检查。

Example: The registry path in windows 2k3 defines the ciphers available to the server:

 

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/SecurityProviders/SCHANNEL/Ciphers/

 

 

Testing SSL certificate validity – client and server测试SSL证书有效期-端和服

 

当访问一个通过HTTPS协议,在客户端(通常是浏览器)和服务器之间会建立一个Web应用程序的安全通道。将会建立通过数字证书手段的id。为了建立连接,需经过一系列的检查。

讨论SSL和基于证书的认证超出了本指南的范围,我们将着重于确定证书的有效性所涉及的主要标准:1)检查颁发机构(CA)是否是已知的2)检查该证书是目前有效的,和3)检查,该网站的名称,和在证书中公布的网站名称匹配。

 

我们来分析细节:

1)每个浏览器带有一个受信任的CA列表,和签署该证书的CA相比,前者列表可以随意定制和扩展,后者是定制的。一般如果浏览器访问到服务器证书的CA未知的站点,通常是提出了警告。当一个Web应用程序建立的是自签名的证书依赖时,最常发生这种情况。这是否将被视为一个问题取决于几个因素。例如,这可能是良性的内联网环境(认为目前企业网站的电子邮件通过https提供;在这里,很显然,所有用户承认内部CA作为受信任的CA)。当一个服务是通过互联网面向公众,但(即当它是非常重要的积极的验证服务器),它通常是必须依靠信任的CA,承认所有的用户群(这里我们停止讨论)

2)证书有有效期,因此他们可能会过期。一个公共服务需要一个时间上有效的证书,否则,就意味着我们所谈论的,一个服务器的可信证书,可能由于没有被更新而过期。

3)如果证书上的名称和服务器的名称不匹配?如果发生这种情况,似乎很可疑。但其实并非不可能。通过基于HTTP1.1的手段,可能会有多个主机共享一个IP地址:头信息的手段。在这种情况下,由于SSL握手检查HTTP请求之前处理服务器证书,不可能分配不同的证书给每个虚拟服务器。因此,如果证书上的名称和服务器的名称不匹配,浏览器通常标出这样的情况。为了避免这种情况,可使用基于IP的虚拟服务器。 [2][3]描述处理这个问题的技术,并允许基于域名的虚拟主机被正确引用。

 

Black Box Testing and examples 黑盒测试

检查证书的有效性。浏览器会发出警告时,当遇到过期的证书,或当由不受信任的CA颁发的证书或证书不匹配。在浏览HTTPS网站时,通过点击查看在浏览器窗口的锁,你可以看看相关证书的信息-包括发行人,有效期,加密特征等。

如果应用程序需要一个客户端证书,您可能已经安装了一个。证书信息可在浏览器中查看。

检查必须适用于任何SSL提供链接服务的渠道。虽然https通常使用端口443,但有可能根据网络应用架构和部署问题而不同(使用非服务标准端口等)。Nessus的漏洞扫描程序具有检查在SSL / TLS上执行SSL检查的能力。

下面的截图是一个高知名度的IT公司的区域网站。由Microsoft Internet Explorer发出警告。

White Box Testing and examples 白盒测试示例

检查在服务器和客户端应用程序使用的水平证书的有效性。主要检查web服务器上的证书,也有其他使用SSL的,比如数据库管理系统。您应该检查应用程序体系结构,以找出所有使用SSL保护的部分。

工具:

§  Vulnerability scanners may include checks regarding certificate validity, including name mismatch and time expiration. They also usually report other information, such as the CA which issued the certificate. Remember, however, that there is no unified notion of a “trusted CA”; what is trusted depends on the configuration of the software and on the human assumptions made beforehand. Browsers come with a preloaded list of trusted CA. If your web application rely on a CA which is not in this list (for example, because you rely on a self-made CA), you should take into account the process of configuring user browsers to recognize the CA.

§  The Nessus scanner includes a plugin to check for expired certificates or certificates which are going to expire within 60 days (plugin “SSL certificate expiry”, plugin id 15901). This plugin will check certificates installed on the server.

§  Vulnerability scanners may include checks against weak ciphers. For example, the Nessus scanner (http://www.nessus.org) has this capability and flags the presence of SSL weak ciphers (see example provided above).

§  You may also rely on specialized tools such as SSL Digger (http://www.foundstone.com/resources/proddesc/ssldigger.htm), or – for the command line oriented – experiment with the openssl tool, which provides access to OpenSSL cryptographic functions directly from a Unix shell (may be already available on *nix boxes, otherwise see www.openssl.org).

§  To identify SSL-based services, use a vulnerability scanner or a port scanner with service recognition capabilities. The nmap scanner features a “-sV” scanning option which tries to identify services, while the Nessus vulnerability scanner has the capability of identifying SSL-based services on arbitrary ports and to run vulnerability checks on them regardless of whether they are configured on standard or non-standard ports.

§  In case you need to talk to a SSL service but your favourite tool doesn’t support SSL, you may benefit from a SSL proxy such as stunnel; stunnel will take care of tunnelling the underlying protocol (usually http, but not necessarily so) and communicate with the SSL service you need to reach.

§  Finally, a word of advice. Though it may be tempting to use a regular browser to check certificates, there are various reasons for not doing so. Browsers have been plagued by various bugs in this area, and the way the browser will perform the check might be influenced by configuration settings that may not be always evident. Instead, rely on vulnerability scanners or on specialized tools to do the job.

 

 

 

 

 

原创粉丝点击