← Back to Writeups
HTBN/AWeb

Rogue Bot (Evaluative)

XESXOR8/23/20262 min read
#web#htb#n/a

Rogue Bot (Evaluative)

Platform: HackTheBox | Category: Web | Type: Challenge | Difficulty: Easy | OS: NA | Author: D3v0o0Nu11 | Date: 2026-01-26 | Status: Solved Techniques: polynomial_evaluation, script_submission

Summary

Task: Compute an 8th-degree polynomial value given coefficients and x. Solution: Submit a Python script to the /run endpoint that evaluates the polynomial using environment variables.

Recon

Port scan

nmap -p- -sV -sC <TARGET> --min-rate 1000 -Pn
PortServiceVersionNotes
<PORT><SVC><VER><notes>

Enumeration highlights

  • Event: hackthebox | ID: 20260126_hackthebox_rogue_bot
  • Tags: python, web, polynomial
  • Indicators: evaluate a polynomial, /run endpoint
  • Source: 20260126_hackthebox_rogue_bot.md

Foothold

Vulnerability / Misconfiguration

  1. Polynomial_evaluation
  2. Script_submission
<command>

Exploitation

  • See original writeup content for detailed exploitation.

Privilege Escalation

Enumeration

sudo -l
find / -perm -4000 2>/dev/null
getcap -r / 2>/dev/null
cat /etc/crontab
ps aux

Exploitation

  1. N/A for challenge-type writeup; see exploitation above.
  2. Flag obtained via challenge solve.
<command>

Flags

FlagLocationValue
flagREDACTED

Key Takeaways / Lessons

  • polynomial_evaluation
  • script_submission
  • Tags: python, web, polynomial

Original Writeup

<details><summary>Click to expand original content</summary>

Rogue Bot (Evaluative) — HackTheBox

Description

The web application presents a task to compute the value of an 8th-degree polynomial: $P(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4 + a_5 x^5 + a_6 x^6 + a_7 x^7 + a_8 x^8$

Given the coefficients $a_i$ and the value $x$, the solution must be submitted to the server.

Analysis

The application has a /run endpoint that accepts a Python script for execution. The task is to write a script that computes the polynomial value based on the provided input data.

Solution

A Python script was written to accept the coefficients and the value $x$, compute the result, and output it.

#!/usr/bin/env python3

def solve():
    # Example input data (received from the server in a real scenario)
    # In this case, the script is submitted to /run and must perform the calculation
    
    # Coefficients a0...a8 and value x are typically passed via environment variables
    # or standard input, depending on the platform implementation.
    # For this task, it was sufficient to implement the computation logic itself.
    
    import os
    
    # Assume coefficients and x are passed as arguments or variables
    # In Rogue Bot they are often hardcoded in the task or passed to the script
    
    a = [int(os.environ.get(f'A{i}', 0)) for i in range(9)]
    x = int(os.environ.get('X', 0))
    
    result = sum(a[i] * (x**i) for i in range(9))
    print(result)

if __name__ == "__main__":
    solve()

After submitting the script to the /run endpoint, the server executed it and returned the flag.

</details>

Auto-tracked: saved to WriteUps; run /xesor-revise to fold lessons into XESXor_Methodology.md.

signed by XESXOR