Microbes have many different pathways into the pulp. Caries and leaking fillings are probably the two most important routes for the invading microbes. Other possibilities include exposed dentine (attrition, abrasion, erosion, periodontal pocket), tooth fractures, dentine microfractures, lateral canals (from an infected pocket), the apical foramen (from a deep pocket), and invaginations.
It is also possible that bacteria may reach the pulp via the bloodstream during transient bacteremias, i.e. by anachoresis. In addition, lack of asepsis during endodontic treatment is a frequent cause of root canal contamination by oral microbes.