The Weasley twins told Harry that the password to the map was: "I solemnly swear that I am up to no good". But how could THEY have known it? It's not exactly LOTR's Moria door with "12345" level of security—you do not have a plaintext password hint (or any).
JKR answered this in one of the interviews. AFAIR, the process in her mind was, quite surprisingly, not unlike real life hacking (you probe and poke around and change the attack based on system feedback to your trial-and-error attempts).
July 16, 2005: Harry Potter and the Half-Blood Prince publication day Edinburgh, Scotland - Part Three.
MA: How did they figure out how to work the map?
JKR: Don't you - well. This is how I explained it to myself at the time, and this does sound glib. Don't you think it would be quite a Fred and Georgeish thing to say in jest, and then see this thing transform?
JKR: Can't you just see them?
ES: But the exact word combination? Is that just a lot of luck, or Felix Felicis -
JKR: Or, the map helped.
MA: Yep, yeah. You can see them sort of answering and joking with each other -
JKR: And the map flickering into life here and there when they got closer and closer, and finally they hit upon the exact right word combination and it just erupts.
Fred and George simply used the process of trial and error. Its very possible that the map recognized them to be very mischevious, so when they got the password wrong, it gave them a little hint that they were getting closer. The Marauders probably made it so the password would be something that trouble-makers could think of. It probably wouldn't help anyone who wasn't up to no good. After all, it was specifically made for mischief.
protected by Community♦ Nov 20 '18 at 13:05
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?