The document discusses an SSRF attack on Amazon EC2 Instance Metadata Service (IMDS) version 1. It describes how IMDSv1 could be accessed from outside the instance by exploiting vulnerabilities in a web application firewall (WAF). The attack allowed accessing credentials of an IAM role that had permissions to an S3 bucket storing personal information. To mitigate such risks, Amazon introduced IMDSv2, which the document then explains can still be bypassed using techniques like the Gopher protocol. It concludes by emphasizing the need for organizations to strengthen defenses against SSRF attacks.
This document summarizes a microservices meetup hosted by @mosa_siru. Key points include:
1. @mosa_siru is an engineer at DeNA and CTO of Gunosy.
2. The meetup covered Gunosy's architecture with over 45 GitHub repositories, 30 stacks, 10 Go APIs, and 10 Python batch processes using AWS services like Kinesis, Lambda, SQS and API Gateway.
3. Challenges discussed were managing 30 microservices, ensuring API latency below 50ms across availability zones, and handling 10 requests per second with nginx load balancing across 20 servers.
This document describes how to configure Spring Security for authentication and authorization in a web application. It defines a WebSecurityConfig class that configures HTTP security with roles like OWNER and MANAGER for access control. It also defines a UserDetailsManager service for loading users and a User entity class implementing UserDetails. Tests are shown for security configuration, login, access control and more using Spring Security's test utilities.
This document summarizes a microservices meetup hosted by @mosa_siru. Key points include:
1. @mosa_siru is an engineer at DeNA and CTO of Gunosy.
2. The meetup covered Gunosy's architecture with over 45 GitHub repositories, 30 stacks, 10 Go APIs, and 10 Python batch processes using AWS services like Kinesis, Lambda, SQS and API Gateway.
3. Challenges discussed were managing 30 microservices, ensuring API latency below 50ms across availability zones, and handling 10 requests per second with nginx load balancing across 20 servers.
This document describes how to configure Spring Security for authentication and authorization in a web application. It defines a WebSecurityConfig class that configures HTTP security with roles like OWNER and MANAGER for access control. It also defines a UserDetailsManager service for loading users and a User entity class implementing UserDetails. Tests are shown for security configuration, login, access control and more using Spring Security's test utilities.
Survey and Analysis of ICS Vulnerabilities (Japanese)Digital Bond
?
Masaki Kubo of JPCERT provides some statistical analysis of the ICS vulnerabilities. He also looks at the coding errors that caused the vulnerabilities and takes an indepth look at recent Yokogawa vulnerabilities.
26. SSRF脆弱性(CWE-918)とは
以下は、SSRF脆弱性の分類を定義しているCWE-918の冒頭の引用。
The web server receives a URL or similar request from an upstream
component and retrieves the contents of this URL, but it does not
sufficiently ensure that the request is being sent to the expected
destination.
参考訳
Webサーバーは、上流のコンポーネントからURLまたは類似のリクエストを受け取
り、このURLの内容を取得するが、リクエストが想定される送信先に送られること
を十分確実にしていない。
要はURLのチェックが不十分なために読まれてはいけないコンテンツを読まれてし
まった、ということで、先の例はまさにそのような例になっている。
? 2016-2019 Hiroshi Tokumaru 26
27. Capital Oneの例
? 2016-2019 Hiroshi Tokumaru 27
? 独自運用のWAFの設定ミスを悪用したSSRF攻撃
HostヘッダにEC2インスタンスを指定することによる攻撃。
設定ミスの詳細は明らかにされていない。
1億人を超える被害者が出た。
WAF EC2インスタンス
GET / HTTP/1.1
Host: 169.254.169.254
35. 参考: cURLの resolve オプションを用いた対策
url = params[:url]
uri = URI.parse(url)
host = uri.host
ip = TCPSocket.gethostbyname(host)[3] # URLからホスト名を取り出し
if ip == '169.254.169.254' # ブラックリストチェック
render html: 'Invalid Host'
return
end
c = Curl::Easy.new(params[:url])
c.resolve = ["%s:%d:%s" % [uri.host, uri.port, ip]] # resolve によりIPアドレスを指定
c.http_get
s = c.body_str
s.force_encoding("UTF-8");
render html: Sanitize.clean(s, Sanitize::Config::RELAXED).html_safe
? 2016-2019 Hiroshi Tokumaru 35
検証済みのIPアドレスで接続を行うことから、DNSリバインディング攻撃を防ぐことができる…はず
36. 速報: EC2にてSSRF多層防御が実装された
What’s new in IMDSv2
With IMDSv2, every request is now protected by session authentication. A session
begins and ends a series of requests that software running on an EC2 instance uses to
access the locally-stored EC2 instance metadata and credentials. The software starts a
session with a simple HTTP PUT request to IMDSv2. IMDSv2 returns a secret token to
the software running on the EC2 instance, which will use the token as a password to
make requests to IMDSv2 for metadata and credentials. Unlike traditional passwords,
you don’t need to worry about getting the token to the software, because the
software gets it for itself with the PUT request. The token is never stored by IMDSv2
and can never be retrieved by subsequent calls, so a session and its token are
effectively destroyed when the process using the token terminates. There’s no limit
on the number of requests within a single session, and there’s no limit on the number
of IMDSv2 sessions. Sessions can last up to six hours and, for added security, a
session token can only be used directly from the EC2 instance where that session
began.
36
https://aws.amazon.com/jp/blogs/security/defense-in-depth-open-firewalls-reverse-
proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/
40. 安全でないデシリアライゼーションによる任意コード実行(PHP)
40
Foo
Bar
class Foo {
private $func;
public function __destruct() {
call_user_func($this->func);
}
}
class Bar {
private $func;
private $args;
public function exec() {
call_user_func_array($this->func, $this->args);
}
}
? 2016-2019 Hiroshi Tokumaru
41. :Foo
func:
安全でないデシリアライゼーションによる任意コード実行
41
:配列
0:
1: 'exec'
:Bar
func = 'system'
args = ['whoami']
1. Fooオブジェクトのデストラクタが呼ばれる
2. call_user_func($this->func) が呼ばれる
3. Barオブジェクトのexecメソッドが呼ばれる
4. Barオブジェクトのexecメソッド内で、call_user_func_array('system', ['whoami']) が呼ばれる
5. system('whoami') が呼ばれる
class Foo {
private $func;
public function __destruct() {
call_user_func($this->func);
}
}
class Bar {
private $func;
private $args;
public function exec() {
call_user_func_array(
$this->func, $this->args);
}
}
? 2016-2019 Hiroshi Tokumaru