Common

IDOR in RoR

Π”ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ .json ΠΊ ΠΏΡƒΡ‚ΠΈ, Ссли Ρƒ нас Ruby

/user_data/2341      --> 401 Unauthorized
/user_data/2341.json --> 200 OK

Redirections

ΠžΠ±Ρ€Π°Ρ‰Π°Ρ‚ΡŒ Π²Π½ΠΈΠΌΠ°Π½ΠΈΠ΅ Π½Π° redirect_to. ΠŸΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΡΠΊΠΈΠΉ Π²Π²ΠΎΠ΄ Π½Π΅ Π΄ΠΎΠ»ΠΆΠ΅Π½ ΠΏΠΎΠΏΠ°Π΄Π°Ρ‚ΡŒ сюда.

? Π­Ρ‚ΠΎΡ‚ URL ΠΏΡ€ΠΈΠ²Π΅Π΄Π΅Ρ‚ ΠΊ отрисовкС Ρ„ΠΎΡ€ΠΌΠΎΡ‡ΠΊΠΈ Π² Firefox ΠΈ Opera:

data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K

RCE Flows

Command Injection

eval("ruby code here")
system("os command here")
`ls -al /` # (backticks contain os command)
exec("os command here")
open("\| os command here")

Code Execution

open-uri

Если ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ Π² ΠΊΠΎΠ΄Π΅ этот ΠΏΠ°ΠΊΠ΅Ρ‚, Ρ‚ΠΎ Π΅ΡΡ‚ΡŒ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ ΠΈΡΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ ΠΊΠΎΠ΄ Π½Π° сторонС сСрвСра (Ρ‚Π°ΠΊ ΠΊΠ°ΠΊ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ Π²Π½ΡƒΡ‚Ρ€ΠΈ Kernel.open)

ΠŸΡ€ΠΈΠΌΠ΅Ρ€ ΠΊΠΎΠ΄Π° уязвимого

Payloads:

Mitigation: ΠΏΠ΅Ρ€Π΅Ρ…ΠΎΠ΄ΠΈΡ‚ΡŒ Π½Π° openURI.

Unsafe Jobs

delayed jobs (e.g. ActiveJob, delayed_job) whose classes accept sensitive data via a perform or initialize method. Jobs are serialized in plaintext, so any sensitive data they accept will be accessible in plaintext to everyone with database access. Instead, consider passing ActiveRecord instances that appropriately handle sensitive data (e.g. encrypted at rest and decrypted when the data is needed) or avoid passing in this data entirely.

When a RegistrationJob gets queued, this job will get serialized, leaving both password and authorization_tokenaccessible in plaintext. Betterment/UnsafeJob can be configured to flag parameters like these to discourage their use. Some ways to remediate this might be to stop passing in password, and to encrypt authorization_token and storing it alongside the user object. For example:

By default, this job will look at classes whose name ends with Job but this can be replaced with any regex.

Macros & Regexp -> Dinamic Params

Render / SSTI

SSTI: https://github.com/swisskyrepo/PayloadsAllTheThings/blob/6bcd2e8a6a39d26a547a70d83dfebef4c2c6f801/Server%20Side%20Template%20Injection/README.md#ruby---basic-injections

Last updated