Remote Code Execution

You have done well to make it this far. The final challenge will test your ability to find and exploit a critical vulnerability in the MCP server.

The `get_fortune` Tool

The developers of this MCP server have left behind a "simplified" code snippet of the `get_fortune` tool's implementation for educational purposes. They wanted to show how easy it is to integrate external commands into an MCP server.

Can you spot the vulnerability?

# --- For educational purposes only ---
# A simplified look at how the get_fortune tool works on the server:
def get_fortune(databases):
    # ... some code ...
    command = "fortune " + " ".join(databases)
    subprocess.run(command, shell=True)
    # ... some code ...

Read the Final Flag

Your mission is to exploit this vulnerability to execute arbitrary commands on the server. To prove that you have RCE, you must read the content of the `flag.txt` file located in the application's directory.

Use what you have learned about the `get_fortune` tool and command injection to get the final flag. Good luck!

Phase 3 Flag

Once you have found the final flag, enter it below to check your answer.