문서의 이전 판입니다!
WAS 보안 취약점 점검
서버 정보 노출
원인
서버 헤더에 해당 서버의 제품명, 버전등이 노출되는 문제
해결방법
Tomcat
server.xml
내의 connector 설정에 server
속성값을 추가한다. 또한 xpoweredBy=“false”
를 추가 해준다. 다만 이 값은 false가 기본값이므로 없는 경우 굳이 추가할 필요는 없다.
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" server="bar" xpoweredBy="false" />
두번째 방법으로 X-Powered-By 헤더가 보이지 않게 하기 위해서는 web.xml
내에 아래와 같은 내용을 추가하도록 한다.
단 이 방법은 아주 오래된 tomcat 6이전 버전에서 사용되던 방법으로 현재는 셋팅 해도 적용되지 않고 의미가 없는 설정이다.
<init-param> <param-name>xpoweredBy</param-name> <param-value>false</param-value> </init-param>
JBoss EAP 6.x
- SERVER 헤더
SERVER
헤더는 완전히 노출되지 않도록 할 수는 없습니다. 다만 헤더의 내용은 임의로 변경 가능합니다.
서버의 해당 org.apache.coyote.http11.Http11Protocol.SERVER
Property값을 설정합니다.
org.apache.coyote.http11.Http11Protocol.SERVER="foo"
또는 설정파일내에 시스템 프로퍼티를 지정합니다.
<system-properties> <property name="org.apache.coyote.http11.Http11Protocol.SERVER" value="foo"/> </system-properties>
- X-PoweredBy 헤더
X-PoweredBy
헤더는 JBoss 옵션을 변경하도록 합니다.
/subsystem=web/configuration=jsp-configuration/:write-attribute(name=x-powered-by,value=false) { "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
그러면 구성파일이 변경되고 아래 섹션이 추가됩니다.
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false"> <configuration> <jsp-configuration x-powered-by="false"/> </configuration> ... ... </subsystem>
서버를 다시 시작하고 변경 사항을 테스트하십시오.
JBoss EAP 7.x
Server: JBoss-EAP/7
와X-Powered-By: Undertow/1
헤더
위 두 헤더 내용을 출력하지 않게 하려면 아래와같은 CLI명령어를 수행하도록 합니다.
/subsystem=undertow/server=default-server/host=default-host/filter-ref=x-powered-by-header:remove /subsystem=undertow/server=default-server/host=default-host/filter-ref=server-header:remove
위 두 헤더를 다른 값으로 변경하고자 할때는 아래 CLI명령어를 수행합니다.
/subsystem=undertow/configuration=filter/response-header=server-header:write-attribute(name=header-value,value=foo) /subsystem=undertow/configuration=filter/response-header=x-powered-by-header:write-attribute(name=header-value,value=bar)
X-Powered-By: JSP/2.3
헤더
이 헤더를 출력하지 않게 하려면 아래 CLI명령어를 수행합니다.
/subsystem=undertow/servlet-container=default/setting=jsp:write-attribute(name=x-powered-by,value=false)
참조링크
Directory Listing
기본적으로 디렉토리 내의 파일 목록이 출력되는것 방지하기
Tomcat
Tomcat 9 버전은 기본적으로 해당 기능이 비활성화 되어있다. 명시적으로 적용하기 위해서는 web.xml
내에 아래와 같이 listings
속성을 false
로 지정하면 된다.
<servlet> <servlet-name>default</servlet-name> <servlet-class> org.apache.catalina.servlets.DefaultServlet </servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>
HTTP Method Limit
특정 HTTP Method를 제한 한다.
Tomcat
<security-constraint> <web-resource-collection> <web-resource-name>Protected Context</web-resource-name> <url-pattern>/*</url-pattern> <http-method>PUT</http-method> <http-method>DELETE</http-method> <http-method>HEAD</http-method> <http-method>TRACE</http-method> <http-method>OPTIONS</http-method> </web-resource-collection> <auth-constraint /> </security-constraint>