A bad ESN isn't a problem with a cell phone, it's a problem with the cellular carrier. ESN is short for Electronic Serial Number, the individual identification number that identifies CDMA phones to the cellular network. If a phone is lost or stolen or the owner is terminated for non-payment and has a remaining balance, the original carrier marks the ESN as bad. The phone cannot be activated on the carrier's network until the problem is resolved.
Call the carrier to find out why the ESN is not working. A customer service representative can tell you whether the phone has a bad ESN because of a remaining balance on an account, or whether the phone bearing that number was reported lost or stolen. However, they may not be able to give you any other information about the account the phone was activated on.
Talk with the person you purchased the phone from. Perhaps they are not aware the ESN is bad, or that they had a remaining balance on the account. The original account holder will need to contact the carrier and clear up any remaining balance before the new owner can activate it.
Activate the phone on another carrier's network. The ESN is only bad for the carrier the phone was originally activated on. There are several CDMA carriers that will accept phones from other networks. If you go this route, you will need to have the phone flashed. Flashing deletes the original carrier's settings and substitutes the settings for the new carrier. Carriers that accept flashed phones usually have stores that can flash the phones for you for a fee.
If you have service with a carrier that accepts flashed phones, you can purchase a phone with a bad ESN on another carrier for substantially less money. Do not buy phones that have bad ESNs due to being lost or stolen.
You can flash a phone with a bad ESN using a computer, but it requires a data cable and special software. If the phone is locked with a subsidy password, you will also need a lock code. Flashing instructions vary depending on the make and model of phone.