SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
dRuby and Security
                          dRubyとセキュリティ

                            西山和広
                            日本Rubyの会



Powered by Rabbit 0.5.7
drubyを不特
定多数に向け
て公開するの
   は危険
Security in rdoc
rdocでのSecurityについての説明
  == Security

  As with all network services, security needs to be considered when
  using dRuby. By allowing external access to a Ruby object, you are
  not only allowing outside clients to call the methods you have
  defined for that object, but by default to execute arbitrary Ruby
  code on your server. Consider the following:

  参考訳:
  あらゆるネットワークサービスと同様に、dRuby を使う場合には
  セキュリティを考慮することが欠かせない。
  ある Ruby オブジェクトへの外部のアクセスを許すことによって、
  そのオブジェクト向けにあなたが定義したメソッドを
  外のクライアントが呼び出すことを許しているだけだはなく、
  そのままだとあなたのサーバ上で任意の Ruby コードを実行する
  ことを許していることになる。



                                                                       2/10
undef and
instance_eval
rdocに載っている方法 (undefと
instance_eval)
  # !!! UNSAFE CODE !!!
  ro = DRbObject::new_with_uri("druby://your.server.com:8989")
  class << ro
    undef :instance_eval # force call to be passed to remote object
  end
  ro.instance_eval("`rm -rf *`")




 本当にこのまま試すのは危険
                                                                  3/10
method_missing
method_missing 直接
  ro.method_missing("instance_eval", "`echo hello druby`")



  呼び出し側の記述が変わるだけ

  出来ることは undef との組み合わせと同じ




                                                         4/10
insecure methods
  # List of insecure methods.
  #
  # These methods are not callable via dRuby.
  INSECURE_METHOD = [
    :__send__
  ]


 drb/drb.rb で禁止されているメソッド
   直接呼べない

   instance_eval などと組み合わせれば呼べる

   send も呼べるのでほとんど制限はない                         5/10
Method
 send_method = ro.method_missing(:method, :__send__)
 send_method.call(:puts, "hello druby!")



 Method オブジェクト経由

 INSECURE_METHOD のチェックを回避可
 能




                                                   6/10
$SAFEをあげて制限
require 'drb'
DRb.start_service("druby://localhost:0", nil, :safe_level => 1)
puts DRb.uri
DRb.thread.join



instance_eval や system などは呼べない

safe level が 1 なら puts は呼べる




                                                              7/10
$SAFEでも防げないもの
DoSを狙うもの
 サーバ側で巨大な文字列を生成など

 rlimit などの OS の機能で制限

他にもあるかも




                        8/10
デモ
時間があればここでデモ




              9/10
まとめ
drubyを不特定多数に向けて公開するのは危険




Powered by Rabbit 0.5.7   10/10

Más contenido relacionado

La actualidad más candente

FreeBSDのpostfixをblacklistd(8)に対応させてみた
FreeBSDのpostfixをblacklistd(8)に対応させてみたFreeBSDのpostfixをblacklistd(8)に対応させてみた
FreeBSDのpostfixをblacklistd(8)に対応させてみたKoichiro Iwao
 
MySQLのパフォーマンスの話
MySQLのパフォーマンスの話MySQLのパフォーマンスの話
MySQLのパフォーマンスの話Tetsuro Ikeda
 
Custom Package Building with Poudriere
Custom Package Building with PoudriereCustom Package Building with Poudriere
Custom Package Building with PoudriereYuichiro Naito
 
シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)icchy
 
リーダブルコード 1.0'
リーダブルコード 1.0'リーダブルコード 1.0'
リーダブルコード 1.0'Yamamura Takashi
 
ストリーム処理エンジン「Zero」の開発と運用
ストリーム処理エンジン「Zero」の開発と運用ストリーム処理エンジン「Zero」の開発と運用
ストリーム処理エンジン「Zero」の開発と運用Eiichi Sato
 
Programming under capability mode
Programming under capability modeProgramming under capability mode
Programming under capability modeYuichiro Naito
 
Rustを勉強してみた!
Rustを勉強してみた!Rustを勉強してみた!
Rustを勉強してみた!ssmylh
 
リーダブルコードが良書だったのでまとめました
リーダブルコードが良書だったのでまとめましたリーダブルコードが良書だったのでまとめました
リーダブルコードが良書だったのでまとめましたTakumi Sato
 
Windowsでも使えるシェル
Windowsでも使えるシェルWindowsでも使えるシェル
Windowsでも使えるシェルTetsuya Hasegawa
 
後期第六回ネットワークチーム講座資料2016
後期第六回ネットワークチーム講座資料2016後期第六回ネットワークチーム講座資料2016
後期第六回ネットワークチーム講座資料2016densan_teacher
 

La actualidad más candente (14)

FreeBSDのpostfixをblacklistd(8)に対応させてみた
FreeBSDのpostfixをblacklistd(8)に対応させてみたFreeBSDのpostfixをblacklistd(8)に対応させてみた
FreeBSDのpostfixをblacklistd(8)に対応させてみた
 
MySQLのパフォーマンスの話
MySQLのパフォーマンスの話MySQLのパフォーマンスの話
MySQLのパフォーマンスの話
 
How to use blacklistd
How to use blacklistdHow to use blacklistd
How to use blacklistd
 
Custom Package Building with Poudriere
Custom Package Building with PoudriereCustom Package Building with Poudriere
Custom Package Building with Poudriere
 
シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)
 
Lt 110205
Lt 110205Lt 110205
Lt 110205
 
リーダブルコード 1.0'
リーダブルコード 1.0'リーダブルコード 1.0'
リーダブルコード 1.0'
 
ストリーム処理エンジン「Zero」の開発と運用
ストリーム処理エンジン「Zero」の開発と運用ストリーム処理エンジン「Zero」の開発と運用
ストリーム処理エンジン「Zero」の開発と運用
 
Programming under capability mode
Programming under capability modeProgramming under capability mode
Programming under capability mode
 
Rustを勉強してみた!
Rustを勉強してみた!Rustを勉強してみた!
Rustを勉強してみた!
 
PHP: Dis Is It
PHP: Dis Is ItPHP: Dis Is It
PHP: Dis Is It
 
リーダブルコードが良書だったのでまとめました
リーダブルコードが良書だったのでまとめましたリーダブルコードが良書だったのでまとめました
リーダブルコードが良書だったのでまとめました
 
Windowsでも使えるシェル
Windowsでも使えるシェルWindowsでも使えるシェル
Windowsでも使えるシェル
 
後期第六回ネットワークチーム講座資料2016
後期第六回ネットワークチーム講座資料2016後期第六回ネットワークチーム講座資料2016
後期第六回ネットワークチーム講座資料2016
 

Destacado

シェルスクリプトで簡易ping監視
シェルスクリプトで簡易ping監視シェルスクリプトで簡易ping監視
シェルスクリプトで簡易ping監視Kazuhiro Nishiyama
 
migrate to magazine.rubyist.net
migrate to magazine.rubyist.netmigrate to magazine.rubyist.net
migrate to magazine.rubyist.netKazuhiro Nishiyama
 
InterClean Retail Truck Wash
InterClean Retail Truck WashInterClean Retail Truck Wash
InterClean Retail Truck WashAdelina Cirstea
 
Pachet Partener Simpozion Management For Customer Service Excellence1
Pachet Partener   Simpozion Management For Customer Service Excellence1Pachet Partener   Simpozion Management For Customer Service Excellence1
Pachet Partener Simpozion Management For Customer Service Excellence1Adelina Cirstea
 
Simpozion Management For Customer Service Excellence1
Simpozion Management For Customer Service Excellence1Simpozion Management For Customer Service Excellence1
Simpozion Management For Customer Service Excellence1Adelina Cirstea
 
正規表現の先読みについて
正規表現の先読みについて正規表現の先読みについて
正規表現の先読みについてKazuhiro Nishiyama
 
nadoka さんの m17n 対応のベストプラクティス
nadoka さんの m17n 対応のベストプラクティスnadoka さんの m17n 対応のベストプラクティス
nadoka さんの m17n 対応のベストプラクティスKazuhiro Nishiyama
 

Destacado (10)

シェルスクリプトで簡易ping監視
シェルスクリプトで簡易ping監視シェルスクリプトで簡易ping監視
シェルスクリプトで簡易ping監視
 
migrate to magazine.rubyist.net
migrate to magazine.rubyist.netmigrate to magazine.rubyist.net
migrate to magazine.rubyist.net
 
InterClean Retail Truck Wash
InterClean Retail Truck WashInterClean Retail Truck Wash
InterClean Retail Truck Wash
 
Pachet Partener Simpozion Management For Customer Service Excellence1
Pachet Partener   Simpozion Management For Customer Service Excellence1Pachet Partener   Simpozion Management For Customer Service Excellence1
Pachet Partener Simpozion Management For Customer Service Excellence1
 
正規表現の \z の話
正規表現の \z の話正規表現の \z の話
正規表現の \z の話
 
Simpozion Management For Customer Service Excellence1
Simpozion Management For Customer Service Excellence1Simpozion Management For Customer Service Excellence1
Simpozion Management For Customer Service Excellence1
 
正規表現の先読みについて
正規表現の先読みについて正規表現の先読みについて
正規表現の先読みについて
 
boot2docker upgrade
boot2docker upgradeboot2docker upgrade
boot2docker upgrade
 
nadoka さんの m17n 対応のベストプラクティス
nadoka さんの m17n 対応のベストプラクティスnadoka さんの m17n 対応のベストプラクティス
nadoka さんの m17n 対応のベストプラクティス
 
lilo.linux.or.jp の話
lilo.linux.or.jp の話lilo.linux.or.jp の話
lilo.linux.or.jp の話
 

Más de Kazuhiro Nishiyama

lilo.linux.or.jp を buster から bullseye に上げた
lilo.linux.or.jp を buster から bullseye に上げたlilo.linux.or.jp を buster から bullseye に上げた
lilo.linux.or.jp を buster から bullseye に上げたKazuhiro Nishiyama
 
小規模個人アプリをRails 7.xにバージョンアップした話
小規模個人アプリをRails 7.xにバージョンアップした話小規模個人アプリをRails 7.xにバージョンアップした話
小規模個人アプリをRails 7.xにバージョンアップした話Kazuhiro Nishiyama
 
Ruby リファレンスマニュアル改善計画 2022 進捗報告
Ruby リファレンスマニュアル改善計画 2022 進捗報告Ruby リファレンスマニュアル改善計画 2022 進捗報告
Ruby リファレンスマニュアル改善計画 2022 進捗報告Kazuhiro Nishiyama
 
fukuoka03-rubima-reboot-rubyist-magazine-reboot.pdf
fukuoka03-rubima-reboot-rubyist-magazine-reboot.pdffukuoka03-rubima-reboot-rubyist-magazine-reboot.pdf
fukuoka03-rubima-reboot-rubyist-magazine-reboot.pdfKazuhiro Nishiyama
 
rubykaigi2022-rurema-history-and-future.pdf
rubykaigi2022-rurema-history-and-future.pdfrubykaigi2022-rurema-history-and-future.pdf
rubykaigi2022-rurema-history-and-future.pdfKazuhiro Nishiyama
 
qemuのriscv64にDebianを入れてみた
qemuのriscv64にDebianを入れてみたqemuのriscv64にDebianを入れてみた
qemuのriscv64にDebianを入れてみたKazuhiro Nishiyama
 
workflow,job,step の使い分けの基準を考える
workflow,job,step の使い分けの基準を考えるworkflow,job,step の使い分けの基準を考える
workflow,job,step の使い分けの基準を考えるKazuhiro Nishiyama
 
あまり知られていないRubyの便利機能
あまり知られていないRubyの便利機能あまり知られていないRubyの便利機能
あまり知られていないRubyの便利機能Kazuhiro Nishiyama
 
Dockerのオフィシャルrubyイメージとは?
Dockerのオフィシャルrubyイメージとは?Dockerのオフィシャルrubyイメージとは?
Dockerのオフィシャルrubyイメージとは?Kazuhiro Nishiyama
 
チャットボットのススメ
チャットボットのススメチャットボットのススメ
チャットボットのススメKazuhiro Nishiyama
 
Action Cableで簡易チャットを作ってみた
Action Cableで簡易チャットを作ってみたAction Cableで簡易チャットを作ってみた
Action Cableで簡易チャットを作ってみたKazuhiro Nishiyama
 
最近のrubyのインストール方法
最近のrubyのインストール方法最近のrubyのインストール方法
最近のrubyのインストール方法Kazuhiro Nishiyama
 

Más de Kazuhiro Nishiyama (20)

lilo.linux.or.jp を buster から bullseye に上げた
lilo.linux.or.jp を buster から bullseye に上げたlilo.linux.or.jp を buster から bullseye に上げた
lilo.linux.or.jp を buster から bullseye に上げた
 
小規模個人アプリをRails 7.xにバージョンアップした話
小規模個人アプリをRails 7.xにバージョンアップした話小規模個人アプリをRails 7.xにバージョンアップした話
小規模個人アプリをRails 7.xにバージョンアップした話
 
Ruby リファレンスマニュアル改善計画 2022 進捗報告
Ruby リファレンスマニュアル改善計画 2022 進捗報告Ruby リファレンスマニュアル改善計画 2022 進捗報告
Ruby リファレンスマニュアル改善計画 2022 進捗報告
 
fukuoka03-rubima-reboot-rubyist-magazine-reboot.pdf
fukuoka03-rubima-reboot-rubyist-magazine-reboot.pdffukuoka03-rubima-reboot-rubyist-magazine-reboot.pdf
fukuoka03-rubima-reboot-rubyist-magazine-reboot.pdf
 
rubykaigi2022-rurema-history-and-future.pdf
rubykaigi2022-rurema-history-and-future.pdfrubykaigi2022-rurema-history-and-future.pdf
rubykaigi2022-rurema-history-and-future.pdf
 
qemuのriscv64にDebianを入れてみた
qemuのriscv64にDebianを入れてみたqemuのriscv64にDebianを入れてみた
qemuのriscv64にDebianを入れてみた
 
systemd 再入門
systemd 再入門systemd 再入門
systemd 再入門
 
Ruby 3.0.0 コネタ集
Ruby 3.0.0 コネタ集Ruby 3.0.0 コネタ集
Ruby 3.0.0 コネタ集
 
livedoor天気API終了対応
livedoor天気API終了対応livedoor天気API終了対応
livedoor天気API終了対応
 
Wireguard 実践入門
Wireguard 実践入門Wireguard 実践入門
Wireguard 実践入門
 
workflow,job,step の使い分けの基準を考える
workflow,job,step の使い分けの基準を考えるworkflow,job,step の使い分けの基準を考える
workflow,job,step の使い分けの基準を考える
 
あまり知られていないRubyの便利機能
あまり知られていないRubyの便利機能あまり知られていないRubyの便利機能
あまり知られていないRubyの便利機能
 
Dockerのオフィシャルrubyイメージとは?
Dockerのオフィシャルrubyイメージとは?Dockerのオフィシャルrubyイメージとは?
Dockerのオフィシャルrubyイメージとは?
 
チャットボットのススメ
チャットボットのススメチャットボットのススメ
チャットボットのススメ
 
Dokku の紹介
Dokku の紹介Dokku の紹介
Dokku の紹介
 
Action Cableで簡易チャットを作ってみた
Action Cableで簡易チャットを作ってみたAction Cableで簡易チャットを作ってみた
Action Cableで簡易チャットを作ってみた
 
Ruby svn to git
Ruby svn to gitRuby svn to git
Ruby svn to git
 
Ruby 2.6 Update
Ruby 2.6 UpdateRuby 2.6 Update
Ruby 2.6 Update
 
最近のrubyのインストール方法
最近のrubyのインストール方法最近のrubyのインストール方法
最近のrubyのインストール方法
 
Language update 2018 - ruby
Language update 2018 - rubyLanguage update 2018 - ruby
Language update 2018 - ruby
 

Último

Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 

Último (10)

Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 

dRuby and Security