55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
id: privesc-ruby
|
|
|
|
info:
|
|
name: Ruby - Privilege Escalation
|
|
author: daffainfo
|
|
severity: high
|
|
description: |
|
|
Ruby is a dynamic, open-source programming language known for its simplicity and productivity. It is often used for web development, scripting, and software development. Ruby's elegant syntax and focus on developer happiness have made it a popular choice for building web applications and other software projects.
|
|
reference:
|
|
- https://gtfobins.github.io/gtfobins/ruby/
|
|
metadata:
|
|
verified: true
|
|
tags: code,linux,ruby,privesc
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
whoami
|
|
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
ruby -e 'exec "whoami"'
|
|
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
sudo ruby -e 'exec "whoami"'
|
|
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
ruby -e 'Process::Sys.setuid(0); exec "whoami"'
|
|
|
|
matchers-condition: and
|
|
matchers:
|
|
- type: word
|
|
part: code_1_response
|
|
words:
|
|
- "root"
|
|
negative: true
|
|
|
|
- type: dsl
|
|
dsl:
|
|
- 'contains(code_2_response, "root")'
|
|
- 'contains(code_3_response, "root")'
|
|
- 'contains(code_4_response, "root")'
|
|
condition: or
|
|
# digest: 4a0a0047304502200d04ad6da824e3e4f8d827df453f11e89847545580da1379ad50187f92ce04fd022100889cc924bcb70907e887d989a704b2619b0fe0c144d7977a67fa607bcaf34645:922c64590222798bb761d5b6d8e72950 |