A novel technique for measuring the mass of the top quark that uses only the kinematic properties of its charged decay products is presented. Top quark pair events with final states with one or two charged leptons and hadronic jets are selected from the data set of 8 TeV proton-proton collisions, corresponding to an integrated luminosity of 19.7 fb-1. By reconstructing secondary vertices inside the selected jets and computing the invariant mass of the system formed by the secondary vertex and an isolated lepton, an observable is constructed that is sensitive to the top quark mass that is expected to be robust against the energy scale of hadronic jets. The main theoretical systematic uncertainties, concerning the modeling of the fragmentation and hadronization of b quarks and the reconstruction of secondary vertices from the decays of b hadrons, are studied. A top quark mass of 173.68±0.20(stat)-0.97+1.58(syst) GeV is measured. The overall systematic uncertainty is dominated by the uncertainty in the b quark fragmentation and the modeling of kinematic properties of the top quark.