All-rounder Stokes, who missed four Tests after tearing the same hamstring in The Hundred domestic competition in August, sustained the injury in the third Test of England's 2-1 series win over New Zealand last week.
"Something else to overcome…go on then!" Stokes wrote on his X account.
"I've got so much more left in this tank and so much more blood sweat and tears to go through for my team and this shirt. There's a reason I have a Phoenix permanently inked on my body."
The all-rounder bowled 24 overs in New Zealand's first innings and was two balls into his 13th over of the second when he suffered the injury - a much heavier workload than in the first two Tests.
"The Durham all-rounder will undergo surgery in January," the ECB added in a statement.
England do not play again in the longest format until a one-off Test against Zimbabwe in May before a five-match home series against India in July and August.