作者:Yiming Gong http://security.zz.ha.cn
" P" g- J* ~* h默认情况下apache是会给client端回显版本号码的,可以测试如下,在client端使用nc联接起着apache的目的主机80端口,发送错误的get请求
yiming# nc security.zz.ha.cn 809 b* r/ [* w) d' Q2 J get index.lakdsjf <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head>- q4 h; A2 Y0 i <title>400 Bad Request</title>' M L' @( N$ k. ] </head><body> <h1>Bad Request</h1>8 X& g. s3 G0 i" W8 n( v: O$ H <p>Your browser sent a request that this server could not understand.<br />/ V% M& B Z5 [# R1 { </p> <hr /> <address>Apache/x.y.z Server at security.zz.ha.cn Port 80</address> C# h! b V& o* w) T' h </body></html>
+ n; G- d% M+ a& A" g; F& M+ ]! |5 \( Y 我们看到上面显示了apache的版本号(:) 俺隐去了真实版本),这可不太好,能修改一下么?) l) i+ k+ c5 x& ]2 z& S2 S9 e 答案是肯定的! 改动apache的配置文件,找到ServerTokens和ServerSignature两个directive,修改默认属性:! ~: k% A. [9 w( B8 f2 D! W 如下
# and compiled in modules. #) }. ~" B0 z/ M# D+ E# }( } # ServerTokens # This directive configures what you return as the Server HTTP response # Header. The default is 'Full' which sends information about the OS-Type) [7 M: ?: t2 ?; J, p( ^ # and compiled in modules.7 e9 S( ^3 U: ]: g4 Y # Set to one of: Full | OS | Minor | Minimal | Major | Prod # where Full conveys the most information, and Prod the least. # #ServerTokens Full$ B* _9 Q' t$ Y+ G ServerTokens Prod
# # Optionally add a line containing the server version and virtual host # name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents). # Set to "EMail" to also include a mailt link to the ServerAdmin.( P: l0 g, E8 n8 A9 ~ # Set to one of: On | Off | EMail" f% b; x+ c7 V3 @7 P # ServerSignature On ServerSignature Off
0 Z+ l+ T; _* Q; i9 p: b修改后重起apache,再看看, + D$ w$ Q; Q, R; M- [ yiming# nc security.zz.ha.cn 80 get index.lakdsjf( s6 g, J5 S( F( u1 C' N: [3 T <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1>3 o$ a- D2 X& ~# i3 u8 C c0 E9 Y& p <p>Your browser sent a request that this server could not understand.<br />3 G$ J5 f* n. B; J </p> </body></html>
| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |