Without seeing a video of the squat, it's hard to say what happened to cause the pull. My only guess would be that your other knee may have caved a little as you were driving up, throwing an asymmetric stress on the injured side, but that's just pulled out of my ass. You say that you only feel it when coming up from a squatting position; does this mean that it doesn't hurt to deadlift? If that's true, it is prolly not a hamstring, and you may not mean the "back" of your "leg".
Whatever caused it, here is the tried-and-true injury rehab method for muscle-belly injuries we got from Starr and that has worked for years better than any other method I've ever used. Wait 3-4 days until the pain starts to "blur",which indicates that the immediate process of healing has stopped the bleeding and has started to repair the tissue. Then use an exercise that directly works the injury, i.e. that makes it hurt, in this case the squat. Use the empty bar and do 3 sets of 25 with perfect form, allowing yourself NO favoring the injured side. If it's ready to rehab you will know by the pain: if the pain increases during the set, it's not ready, if it stays the same or feels a little better toward the end of the set, it is ready to work.
The NEXT DAY do it again, and add a small amount of weight, like 45 x 25 x 2 , 55 x 25. Next day, 45 x 25, 55 x 25, 65 x 25. Continue adding weight every day, increasing as much as you can tolerate each workout. It will hurt, and it's supposed to hurt, but you should be able to tell the difference between rehab pain and re-injury. If you can't, you will figure it out soon enough. This method works by flushing blood through the injury while forcing the tissue to reorganize in its normal pattern of contractile architecture.
After 10 days of 25s, go up in weight and down in reps to 15s, then to 10s, and finally to fives. During this time do NO OTHER HEAVY WORK, so that your resources can focus on the injury. You should be fixed in about 2 weeks, squatting more than you hurt yourself with.
This method has the advantage of preventing scar formation in the muscle belly, since the muscle is forced to heal in the context of work and normal contraction, using the movement pattern it normally uses. The important points are 1.) perfect form with 2.) light weights that can be handled for high reps, 3.) every day for two weeks, and 4.) no other heavy work that will interfere with the system-wide processes of healing the tear.
It is also very important through the whole process of healing the injury that ice be used, during the initial phase after the injury and after the workouts. Use it 20 on/20 off, many times a day at first and then tapering off to morning, after the workout, and before bed. Ice is your best friend in a muscle belly injury, holding down inflammation and fluid accumulation ("swelling") while at the same time increasing beneficial blood flow through the injury. But DO NOT USE ICE MORE THAN 20 MINUTES AT A TIME. More than that can cause more damage than it repairs.
This may actually be the most useful post on this entire little forum of mine, and if you use this method exactly you can save yourself many weeks of lost training and long-term problems with muscle-belly scarring. Try it and see.