permissions := strconv.Atoi(os.Getenv("filePermissions"));
fMode := os.FileMode(permissions)
os.chmod(filePath, fMode);
...
String permissionMask = System.getProperty("defaultFileMask");
Path filePath = userFile.toPath();
...
Set<PosixFilePermission> perms = PosixFilePermissions.fromString(permissionMask);
Files.setPosixFilePermissions(filePath, perms);
...
$rName = $_GET['publicReport'];
chmod("/home/". authenticateUser . "/public_html/" . rName,"0755");
...
../../localuser/public_html/.htpasswd
" 등과 같이 publicReport
에 대해 악성 값을 제공할 경우, 응용 프로그램은 지정된 파일을 공격자가 읽을 수 있게 합니다.
...
$mask = $CONFIG_TXT['perms'];
chmod($filename,$mask);
...
permissions = os.getenv("filePermissions");
os.chmod(filePath, permissions);
...
...
rName = req['publicReport']
File.chmod("/home/#{authenticatedUser}/public_html/#{rName}", "0755")
...
../../localuser/public_html/.htpasswd
" 등과 같이 publicReport
에 대해 악성 값을 제공할 경우, 응용 프로그램은 지정된 파일을 공격자가 읽을 수 있게 합니다.
...
mask = config_params['perms']
File.chmod(filename, mask)
...
crossdomain.xml
구성 파일의 적절한 설정을 통해 정책을 수정할 수 있습니다. 그러나, 지나치게 허용적인 도메인 간 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 설정 변경 시 주의해야 합니다.
flash.system.Security.allowDomain("*");
*
를 allowDomain()
에 대한 인수로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 다른 SWF 응용 프로그램으로 접근할 수 있음을 나타냅니다.crossdomain.xml
구성 파일의 적절한 설정을 통해 정책을 수정할 수 있습니다. Flash Player 9,0,124,0부터 Adobe는 Flash Player에서 여러 도메인에 걸쳐 보낼 수 있는 사용자 지정 헤더를 정의하는 기능도 도입했습니다. 그러나 지나치게 허용적인 도메인 간 정책과 함께 적용할 경우, 지나치게 허용적인 사용자 지정 헤더 정책은 선택된 헤더를 악성 응용 프로그램이 대상 응용 프로그램으로 전송할 수 있어, 수신한 헤더를 처리하지 못하는 응용 프로그램 실행 시 다양한 공격으로 이어지거나 오류가 발생할 수 있기 때문에 이러한 설정 정의 시 주의해야 합니다.
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
*
를 headers
속성 값으로 사용하면 모든 헤더가 여러 도메인에 걸쳐 전송됨을 나타냅니다.crossdomain.xml
구성 파일의 적절한 설정을 통해 정책을 수정할 수 있습니다. 그러나, 지나치게 허용적인 도메인 간 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 설정에 영향을 미칠 수 있는 사람을 결정할 때 주의해야 합니다. 정책 제한 무시 취약점은 다음과 같은 경우 발생합니다.예제 2: 다음 코드는 로드한 SWF 파일에 대한 매개변수 중 하나의 값을 사용하여 신뢰할 수 있는 도메인 목록을 정의합니다.
...
var params:Object = LoaderInfo(this.root.loaderInfo).parameters;
var url:String = String(params["url"]);
flash.system.Security.loadPolicyFile(url);
...
...
var params:Object = LoaderInfo(this.root.loaderInfo).parameters;
var domain:String = String(params["domain"]);
flash.system.Security.allowDomain(domain);
...
crossdomain.xml
구성 파일의 적절한 설정을 통해 이 제한을 수정할 수 있습니다. 그러나 HTTP로 로드한 SWF 응용 프로그램은 MITM(Man-In-The-Middle) 공격을 받을 수 있으므로 이러한 설정 정의 시 주의해야 하며, 따라서 신뢰하지 말아야 합니다.allowInsecureDomain()
을 호출하여 HTTP로 로드된 SWF 응용 프로그램이 HTTPS로 로드된 SWF 응용 프로그램의 데이터에 접근하는 것을 막는 제한을 끕니다.
flash.system.Security.allowInsecureDomain("*");
NameNode
, DataNode
, JobTraker
)가 클러스터의 상태를 변경합니다.Job
전송을 보여 줍니다.
public static void run(String args[]) throws IOException {
String path = "/path/to/a/file";
DFSclient client = new DFSClient(arg[1], new Configuration());
ClientProtocol nNode = client.getNameNode();
/* This sets the ownership of a file pointed by the path to a user identified
* by command line arguments.
*/
nNode.setOwner(path, args[2], args[3]);
...
}
script
태그를 보겠습니다.
<script src="http://www.example.com/js/fancyWidget.js"></script>
www.example.com
이 아닌 다른 웹 사이트에 나타나는 경우, 이 사이트의 정확한 비 악성 코드 사용 여부는 www.example.com
에 따라 달라지게 됩니다. 공격자가 www.example.com
을 손상시킨 경우, fancyWidget.js
의 내용을 변경하여 사이트 보안을 침해할 수 있습니다. 예를 들어 fancyWidget.js
에 코드를 추가하여 사용자의 기밀 데이터를 훔칠 수 있습니다.realloc()
를 사용하지 마십시오. 이 함수를 사용하면 민감한 정보의 사본이 덮어쓰기가 안 되는 메모리에 남겨질 수 있습니다.realloc()
함수는 일반적으로 할당된 메모리 블록의 크기를 증가시킬 때 사용합니다. 이 작업을 수행할 때 이전 메모리 블록의 내용을 더 큰 새 블록에 복사해야 합니다. 이 작업은 원래 블록의 내용을 그대로 유지하지만 프로그램이 접근할 수 없게 하여 프로그램이 메모리의 민감한 데이터를 초기화하는 것을 방지합니다. 이후에 공격자가 메모리 덤프의 내용을 검사하게 되면 민감한 데이터가 노출될 수 있습니다.realloc()
을 호출합니다.
plaintext_buffer = get_secret();
...
plaintext_buffer = realloc(plaintext_buffer, 1024);
...
scrub_memory(plaintext_buffer, 1024);
realloc()
를 사용하기 때문에 처음에 plaintext_buffer
에 할당된 메모리에서 데이터의 복사본이 노출될 수 있습니다.VirtualLock
을 사용하지 마십시오. 함수가 항상 구현되는 것은 아닙니다.VirtualLock
함수는 메모리의 페이지가 디스크에 페이지되는 것을 방지하기 위한 것입니다. 하지만, Windows 95/98/ME에서 이 함수는 스텁(stub)으로 구현되며 아무런 영향을 끼치지 않습니다.
HtmlInputHidden hidden = new HtmlInputHidden();
Hidden hidden = new Hidden(element);
hidden
형식의 <input>
태그는 숨겨진 필드를 사용하고 있음을 나타냅니다.
<input type="hidden">
X-XSS-Protection
헤더는 최신 브라우저에서 기본적으로 활성화됩니다. 이 헤더 값을 false(0)로 설정하면 Cross-Site Scripting 보호가 비활성화됩니다.X-XSS-Protection
헤더가 명시적으로 비활성화되어 있어 Cross-Site Scripting 공격의 위험이 증가할 수 있습니다.X-XSS-Protection
헤더는 최신 브라우저에서 기본적으로 활성화됩니다. 이 헤더 값을 false(0)로 설정하면 Cross-Site Scripting 보호가 비활성화됩니다.
<http auto-config="true">
...
<headers>
...
<xss-protection xss-protection-enabled="false" />
</headers>
</http>
X-XSS-Protection
헤더가 명시적으로 비활성화되어 있어 cross-site scripting 공격의 위험이 증가할 수 있습니다.X-XSS-Protection
헤더는 최신 브라우저에서 기본적으로 활성화됩니다. 이 헤더 값을 false(0)로 설정하면 Cross-Site Scripting 보호가 비활성화됩니다.X-XSS-Protection
헤더가 명시적으로 비활성화되어 있어 cross-site scripting 공격의 위험이 증가할 수 있습니다.X-XSS-Protection
헤더는 최신 브라우저에서 기본적으로 활성화됩니다. 이 헤더 값을 false(0)로 설정하면 Cross-Site Scripting 보호가 비활성화됩니다.
...
var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
...
'mydb'
로 추측할 수 있는 사람은 누구나 데이터베이스에 액세스할 수 있습니다.required
속성을 사용하여 입력 폼 필드가 필요한지 지정할 수 있습니다. 필드 유형을 지정하면 해당 유형에 대하여 입력이 확실히 검사됩니다. 정규식에 대하여 입력을 검사하는 사용자 지정 가능 pattern
속성까지 제공할 수 있습니다. 그러나 이 검증은 폼 태그의 novalidate
속성과 제출 입력 태그의 formnovalidate
속성 추가 시 비활성화됩니다.novalidate
속성을 통해 폼 검증을 비활성화합니다.예제 2: 다음 샘플은
<form action="demo_form.asp" novalidate="novalidate">
E-mail: <input type="email" name="user_email" />
<input type="submit" />
</form>
formnovalidate
속성을 통해 폼 검증을 비활성화합니다.
<form action="demo_form.asp" >
E-mail: <input type="email" name="user_email" />
<input type="submit" formnovalidate="formnovalidate"/>
</form>
SECURE_CROSS_ORIGIN_OPENER_POLICY = 'unsafe-none'
Application_BeginRequest
메서드가 비어 있거나 X-Content-Type-Options
를 nosniff
로 설정하는 함수 호출을 포함하지 않거나 해당 헤더를 제거하려고 합니다.X-Content-Type-Options: nosniff
라는 HTTP 헤더를 사용해야 합니다.X-Content-Type-Options
를 nosniff
로 설정하지 않습니다.X-Content-Type-Options: nosniff
를 사용합니다.net.http.DetectContentType()
을 사용하여 응답 Content-Type을 결정합니다.
...
resp, err := http.Get("http://example.com/")
if err != nil {
// handle error
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
content_type := DetectContentType(body)
...
X-Content-Type-Options
를 nosniff
로 설정하거나 이 보안 헤더를 명시적으로 비활성화하지 않습니다.X-Content-Type-Options: nosniff
라는 HTTP 헤더를 사용해야 합니다.
<http auto-config="true">
...
<headers>
...
<content-type-options disabled="true"/>
</headers>
</http>
X-Content-Type-Options
를 nosniff
로 설정하거나 이 보안 헤더를 명시적으로 비활성화하지 않습니다.X-Content-Type-Options: nosniff
라는 HTTP 헤더를 사용해야 합니다.X-Content-Type-Options
를 nosniff
로 설정하거나 이 보안 헤더를 명시적으로 비활성화하지 않습니다.X-Content-Type-Options: nosniff
라는 HTTP 헤더를 사용해야 합니다.script-src
, img-src
, object-src
, style_src
, font-src
, media-src
, frame-src
, connect-src
.*
를 사용할 수도 있습니다. 지정자를 반드시 사용해야 하는 것은 아닙니다. 브라우저는 목록에 나열되지 않은 지정자에 대해 모든 소스를 허용하기도 하고 선택적 default-src
지정자에서 값을 파생하기도 합니다. 또한, 이 헤더의 사양은 시간이 지남에 따라 발전해 왔습니다. Firefox(버전 23까지)와 IE(버전 10까지)에서는 X-Content-Security-Policy
로 구현되어 있었으며 Chrome(버전 25까지)에서는 X-Webkit-CSP
로 구현되어 있었습니다. 하지만 이제는 새 표준 이름인 Content Security Policy
를 사용하기 위해 두 이름 모두 더 이상 사용되지 않습니다. 지정자의 수, 더 이상 사용되지 않는 2개의 대체 이름, 그리고 단일 헤더에서 여러 번 나타나는 동일한 헤더와 반복되는 지정자가 처리되는 방식을 감안하면 개발자가 이 헤더를 잘못 구성할 확률이 높습니다.unsafe-inline
또는 unsafe-eval
이 포함된 지정자는 CSP를 사용하는 목적을 무효화합니다.script-src
지정자가 설정되어 있지만 nonce
스크립트는 구성되어 있지 않습니다.frame-src
가 설정되어 있지만 sandbox
는 구성되어 있지 않습니다.django-csp
구성에서는 안전하지 않은 unsafe-inline
및 unsafe-eval
지정자를 사용하여 인라인 스크립트 및 코드 평가를 허용합니다.
...
MIDDLEWARE = (
...
'csp.middleware.CSPMiddleware',
...
)
...
CSP_DEFAULT_SRC = ("'self'", "'unsafe-inline'", "'unsafe-eval'", 'cdn.example.net')
...
X-Frame-Options
헤더가 포함됩니다. 이 헤더를 사용하지 않거나 설정하지 않으면 cross-frame 관련 취약점이 발생할 수 있습니다.X-Frame-Options
헤더를 사용하지 않도록 Spring Security로 보호된 응용 프로그램을 구성합니다.
<http auto-config="true">
...
<headers>
...
<frame-options disabled="true"/>
</headers>
</http>
script-src
, img-src
, object-src
, style_src
, font-src
, media-src
, frame-src
, connect-src
. 이러한 8개의 지정자는 사이트가 해당 지정자에서 관여하는 기능에 접근할 수 있는 도메인을 지정하는 값으로 소스 목록을 사용합니다. 개발자는 전체 또는 일부 소스를 나타내기 위해 와일드카드인 *
를 사용할 수도 있습니다. 'unsafe-inline'
및 'unsafe-eval'
과 같은 추가 소스 목록 키워드를 사용하면 스크립트 실행을 보다 세밀하게 제어할 수 있지만 잠재적으로 유해합니다. 지정자를 반드시 사용해야 하는 것은 아닙니다. 브라우저는 목록에 나열되지 않은 지정자에 대해 모든 소스를 허용하기도 하고 선택적 default-src
지정자에서 값을 파생하기도 합니다. 또한, 이 헤더의 사양은 시간이 지남에 따라 발전해 왔습니다. Firefox 버전 23 이하 및 IE 버전 10 이하에서는 X-Content-Security-Policy
로, Chrome 버전 25 이하에서는 X-Webkit-CSP
로 구현되었습니다. 하지만 이제는 새 표준 이름인 Content Security Policy
를 사용하므로 이러한 두 이름은 더 이상 사용되지 않습니다. 지정자의 수, 더 이상 사용되지 않는 2개의 대체 이름, 그리고 단일 헤더에서 여러 번 나타나는 동일한 헤더와 반복되는 지정자가 처리되는 방식을 감안하면 개발자가 이 헤더를 잘못 구성할 확률이 높습니다.default-src
지정자를 설정합니다.
<http auto-config="true">
...
<headers>
...
<content-security-policy policy-directives="default-src '*'" />
</headers>
</http>
script-src
, img-src
, object-src
, style_src
, font-src
, media-src
, frame-src
, connect-src
. 이러한 8개의 지정자는 사이트가 해당 지정자에서 관여하는 기능에 접근할 수 있는 도메인을 지정하는 값으로 소스 목록을 사용합니다. 개발자는 전체 또는 일부 소스를 나타내기 위해 와일드카드인 *
를 사용할 수도 있습니다. 'unsafe-inline'
및 'unsafe-eval'
과 같은 추가 소스 목록 키워드를 사용하면 스크립트 실행을 보다 세밀하게 제어할 수 있지만 잠재적으로 유해합니다. 지정자를 반드시 사용해야 하는 것은 아닙니다. 브라우저는 목록에 나열되지 않은 지정자에 대해 모든 소스를 허용하기도 하고 선택적 default-src
지정자에서 값을 파생하기도 합니다. 또한, 이 헤더의 사양은 시간이 지남에 따라 발전해 왔습니다. Firefox 버전 23 이하 및 IE 버전 10 이하에서는 X-Content-Security-Policy
로, Chrome 버전 25 이하에서는 X-Webkit-CSP
로 구현되었습니다. 하지만 이제는 새 표준 이름인 Content Security Policy
를 사용하므로 이러한 두 이름은 더 이상 사용되지 않습니다. 지정자의 수, 더 이상 사용되지 않는 2개의 대체 이름, 그리고 단일 헤더에서 여러 번 나타나는 동일한 헤더와 반복되는 지정자가 처리되는 방식을 감안하면 개발자가 이 헤더를 잘못 구성할 확률이 높습니다.*-src
지정자는 *
같이 지나치게 허용적인 정책으로 구성되어 왔습니다.django-csp
설정에서는 지나치게 허용적이며 안전하지 않은 default-src
지정자를 설정합니다.
...
MIDDLEWARE = (
...
'csp.middleware.CSPMiddleware',
...
)
...
CSP_DEFAULT_SRC = ("'self'", '*')
...
Access-Control-Allow-Origin
이라는 새 HTTP 헤더가 정의될 경우 JavaScript가 도메인 전체의 데이터에 액세스할 수 있습니다. 이 헤더가 있는 경우, 웹 서버는 cross-origin 요청을 사용하여 해당 도메인에 액세스할 수 있는 다른 도메인을 정의합니다. 그러나, 지나치게 허용적인 CORS 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 헤더 정의 시 주의해야 합니다.
Response.AppendHeader("Access-Control-Allow-Origin", "*");
*
를 Access-Control-Allow-Origin
헤더의 값으로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 실행 중인 JavaScript에 접근할 수 있음을 나타냅니다.Access-Control-Allow-Origin
이라는 새 HTTP 헤더가 정의될 경우 JavaScript가 도메인 전체의 데이터에 액세스할 수 있습니다. 이 헤더가 있는 경우, 웹 서버는 cross-origin 요청을 사용하여 해당 도메인에 액세스할 수 있는 다른 도메인을 정의합니다. 그러나, 지나치게 허용적인 CORS 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 헤더 정의 시 주의해야 합니다.
<websocket:handlers allowed-origins="*">
<websocket:mapping path="/myHandler" handler="myHandler" />
</websocket:handlers>
*
를 Access-Control-Allow-Origin
헤더의 값으로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 실행 중인 JavaScript에 접근할 수 있음을 나타냅니다.Access-Control-Allow-Origin
이라는 새 HTTP 헤더가 정의될 경우 JavaScript가 도메인 전체의 데이터에 액세스할 수 있습니다. 이 헤더가 있는 경우, 웹 서버는 cross-origin 요청을 사용하여 해당 도메인에 액세스할 수 있는 다른 도메인을 정의합니다. 그러나, 지나치게 허용적인 CORS 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 헤더 정의 시 주의해야 합니다.
<?php
header('Access-Control-Allow-Origin: *');
?>
*
를 Access-Control-Allow-Origin
헤더의 값으로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 실행 중인 JavaScript에 접근할 수 있음을 나타냅니다.Access-Control-Allow-Origin
이라는 새 HTTP 헤더가 정의될 경우 JavaScript가 도메인 전체의 데이터에 액세스할 수 있습니다. 이 헤더가 있는 경우, 웹 서버는 cross-origin 요청을 사용하여 해당 도메인에 액세스할 수 있는 다른 도메인을 정의합니다. 그러나, 지나치게 허용적인 CORS 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 헤더 정의 시 주의해야 합니다.
response.addHeader("Access-Control-Allow-Origin", "*")
*
를 Access-Control-Allow-Origin
헤더의 값으로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 실행 중인 JavaScript에 접근할 수 있음을 나타냅니다.Access-Control-Allow-Origin
이라는 새 HTTP 헤더가 정의될 경우 JavaScript가 도메인 전체의 데이터에 액세스할 수 있습니다. 이 헤더가 있는 경우, 웹 서버는 cross-origin 요청을 사용하여 해당 도메인에 액세스할 수 있는 다른 도메인을 정의합니다. 그러나, 지나치게 허용적인 CORS 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 헤더 정의 시 주의해야 합니다.
play.filters.cors {
pathPrefixes = ["/some/path", ...]
allowedOrigins = ["*"]
allowedHttpMethods = ["GET", "POST"]
allowedHttpHeaders = ["Accept"]
preflightMaxAge = 3 days
}
*
를 Access-Control-Allow-Origin
헤더의 값으로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 실행 중인 JavaScript에 액세스할 수 있음을 나타냅니다.Access-Control-Allow-Origin
이라는 새 HTTP 헤더가 정의될 경우 JavaScript가 도메인 전체의 데이터에 액세스할 수 있습니다. 이 헤더가 있는 경우, 웹 서버는 cross-origin 요청을 사용하여 해당 도메인에 액세스할 수 있는 다른 도메인을 정의합니다. 그러나, 지나치게 허용적인 CORS 정책을 사용하면 악성 응용 프로그램이 부적절한 방법으로 피해자 응용 프로그램과 통신하여 스푸핑, 데이터 도난, 릴레이 및 기타 공격으로 이어질 수 있기 때문에 헤더 정의 시 주의해야 합니다.
Response.AddHeader "Access-Control-Allow-Origin", "*"
*
를 Access-Control-Allow-Origin
헤더의 값으로 사용하는 것은 응용 프로그램의 데이터가 임의의 도메인에서 실행 중인 JavaScript에 접근할 수 있음을 나타냅니다.