The targeted creature doesn’t have to be attacking you. It can be attacking a planeswalker, or (in a multiplayer game) it can be attacking another player.

Artwork
Loading artwork…
Mystifying Maze
Commander 2017 · #264 · EN
Nonfoil—Foil—
Card rules
Rare · Illustrated by Robh Ruppel
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Penny Legal
PreDH Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Future Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Pioneer Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
At the beginning of the next end step, the affected creature is returned to the battlefield even if Mystifying Maze is no longer on the battlefield by then.
An “attacking creature” is one that has been declared as an attacker this combat, or one that was put onto the battlefield attacking this combat. Unless that creature leaves combat, it continues to be an attacking creature through the end of combat step, even if the player it was attacking has left the game, or the planeswalker it was attacking has left combat.