Young’s elastic modulus and Poisson’s ratio of the cement in a cased borehole are important in the prediction of the cement sheath integrity under hydraulic fracturing. Although these mechanical properties can be derived in principle from the bulk velocities, the inversion of these velocities of the cement from the received full waveforms remains a challenging problem, especially the S-wave velocity. We have developed an inversion method based on the round-trip traveltimes of the leaked flexural waves (TTL) to invert the bulk velocities of the medium behind the casing. The traveltime difference between the casing wave and the delayed casing wave is the additional time for the leaked wave to travel in the interlayer to the formation and back to the casing. To demonstrate the effectiveness of this method, synthetic full waveforms with a changing interlayer are calculated when an ultrasonic acoustic beam is incident obliquely on the casing. The traveltimes of the wave packets are picked from the envelope curve of the full waveform and then used to invert the bulk velocities in the TTL method. The inverted S-wave velocity of cement is quite accurate with an error rate smaller than 3%, no matter whether the cement is of the ordinary, heavy, or light type. When the interlayer is mud, the P-wave is inverted with an error rate of less than 2%. The P-wave velocity is inverted roughly with an error rate of approximately 10% when the medium behind the casing is light cement.