If you've forgotten your Security code IE. your code is 54321, and you type 54231 or anything else, a few times, the phone will request the Master code which is used to reset the security code. Type any code 12845, 23105, 49521... keep going until the phone request the master code.
You're not confusing other codes, by any chance?
SIM pin code:
This is a pin code that locks the sim card until you enter the correct code. This protects your account, even
if your sim is put into another handset. To reset it, you need the PUK code:
Pin Unlock Code (PUK)
If you miss keyed (or forget) your SIM PIN code, and enter the wrong one 3-5 times in a row, the sim will lock up, and you’ll need to enter the unlock code to release it. You should ask your Network Service Provider
for this code when you need it. Don’t try to guess it, because after a few wrong guesses, the SIM card will be permanently disabled.
Phone Security Code:
This locks the handset, as opposed to the sim card. You can also set some handsets to only accept a “new” sim if the phone security code is entered. To reset it, you need the Mastercode code:
Master Reset Code
Sometimes known as the Master Code, this allows you to unlock a handset if you have entered the Security
Code wrongly too many times.
Which is the one that you want?
This is not a security code, but it works like one! To help combat mobile phone thefts, the networks share a database of the IMEI (International Mobile Equipment Identity) of mobile phones that have been reported stolen. Once a phone is on this list, it will not be allowed to use any of the networks.
This can be a risk if you buy a second-hand phone, because if it has been stolen, or if an unscrupulous seller makes an insurance claim after selling, the phone you bought in good faith may be permanently disabled.
Be very careful to check the source of a second-hand phone!