Setting a breakpoint before calling printf it's possible to see that there are addresses to return to the binary in the stack and also libc addresses:
Trying different offsets, the %21$p can leak a binary address (PIE bypass) and %25$p can leak a libc address:
Subtracting the libc leaked address with the base address of libc, it's possible to see that the offset of the leaked address from the base is 0x49c40.
x30 offset
See the previous example as the bof is the same.
Find Gadgets
Like in the previous example, we need to have in x0 the address to the string /bin/sh and call system.
Using rooper another interesting gadget was found: