You can find couple of tutorials on internet that talk about how you can Unlock your particular iPhone on specific iOS and baseband combination.
Lets just take a step further by talking about a Universal Unlock for iPhone 4, 4S.
It’s quiet easy. All you need to do is Jailbreak your iPhone, (you can follow Jailbreaking tutorials here) and follow some simple steps after that get any iPhone unlocked.
As per MuscleNerd, a Chinese researcher by the name of Loktar_Sun has made it possible to unlock any jailbroken iPhone with the help of the Subscriber Artificial Module (SAM) by Sam Bingner.
This unlock method has now matured into an application. The method produces a ticket that is valid only for the SIM card that is used during the procedure. Hence if you happen to use multiple SIM cards with your iPhone, you will have to repeat the procedure for all of them.
Pre-Requisites: Before you begin with the tutorial, make sure that your iPhone’s IMEI is not blacklisted. A computer with a fully working internet connection and the latest version of iTunes installed is also required, as is the original carrier information of the locked device in question.
Step 1: Add the repo to cydia: http://repo.bingner.com. This contains the latest official SAM package and all the possible dependencies.
Step 2: Launch SAMPrefs from Springboard. Make sure that the SIM card is already inserted into iPhone.
Step 3: Select the ‘Utilities‘ option followed by ‘De-Activate iPhone‘. The device ActivationState should now show as ‘Unactivated‘.
Step 4: Keep SAM enabled and choose ‘By Country and Carrier’ in the Method options. Look through the list and locate your carrier. Be aware that some networks work with more than network ID, i.e. you may have to select the ‘SIM ID’ option.
Step 5: Navigate to ‘More Information‘ and keep a note of the IMSI under ‘SAM Details‘ section before tapping ‘Spoof Real SIM to SAM’. Go to the main SAM screen and change ‘Method’ to manual and paste or enter the IMSI string that you noted down in Step 4.
Step 6: Connect the iPhone to your PC/ Mac & let iTunes to re-activate the phone. Next, double click the Phone Number section of the device details and make sure that the displayed ICCID matches that found on the SIM card. If the strings do not match, start the process from the start.
Step 7: Unplug the device and disable the SAM package. Re-connect the device to iTunes and ignore error messages that might appear. Re-Open iTunes if you wish to be satisfied. Within couple of seconds, your iPhone would display those blue signal bars, a sign of relief.
Troubleshooting: If your iPhone’s push notifications have ceased working, don’t worry about it yet. You can fix this by selecting ‘Clear Push‘ option in SAM and then connecting the device to iTunes.
Note: If you’re looking for multiple SIM unlocks for the same iPhone, below section is for you:
Manually saving each valid unlock ticket
Step 1: Run through all the steps above for each SIM card once. SSH into the jailbroken device & Navigate to /var/Root/library/Lockdown and make a copy of everything that is found in that directory for each SIM card.
It worked for us all fine for Unlocking iPhone 3GS, 4, 4S.