← Back to Writeups
CUSTOMEasyReversing

Ruby

XESXOR9/2/20261 min read
#reversing#custom#easy#factorial_reverse_lookup#source_code_analysis

Ruby

Platform: CUSTOM | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: factorial_reverse_lookup, source_code_analysis

Summary

Walkthrough of the CUSTOM Reversing Ruby. Language: Ruby. Source code provided. Program reads numbers and checks their factorials.

Description

Language: Ruby. Source code provided. Program reads numbers and checks their factorials.

Analysis

ruby
def f(n)
    (2..n).reduce(1, :*)  # factorial
end
a = STDIN.readlines.map {|x| x.to_i}
puts (a.map {|x| f x}) ==
    [3628800, 265252859812191058636308480000000, 30414093201713378043612608166064768844377641568960512000000000000] ? "Correct" : "Incorrect"

Need to find numbers whose factorials equal the given values:

  • 3628800 = 10!
  • 265252859812191058636308480000000 = 30!
  • 30414093201713378043612608166064768844377641568960512000000000000 = 50! ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Solution

Enter numbers 10, 30, 50. The flag is the numbers concatenated: REDACTED. ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

Key Takeaways / Lessons

  • Mastering factorial_reverse_lookup, source_code_analysis was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2026-03-09 • CUSTOM • Ruby • Difficulty: Easy