A sharp-interface numerical approach is developed for modeling the electrochemical environment in crevices and pits due to galvanic corrosion in aqueous media. The concentration of chemical species and the electrical potential in the crevice or pit solution environment is established using the steady state Nernst–Planck equations along with the assumption of local electroneutrality (LEN). The metal-electrolyte interface fluxes are defined in terms of the cathodic and anodic current densities using Butler–Volmer kinetics. The extended finite element method (XFEM) is employed to discretize the nondimensionalized governing equations of the model and a level set function is used to describe the interface morphology independent of the underlying finite element mesh. Benchmark numerical studies simulating intergranular crevice corrosion in idealized aluminum–magnesium (Al–Mg) alloy microstructures in two dimensions are presented. Simulation results indicate that corrosive dissolution of magnesium is accompanied by an increase in the *p*H and chloride concentration of the crevice solution environment, which is qualitatively consistent with experimental observations. Even for low current densities the model predicted *p*H is high enough to cause passivation, which may not be physically accurate; however, this model limitation could be overcome by including the hydrolysis reactions that potentially decrease the *p*H of the crevice solution environment. Finally, a mesh convergence study is performed to establish the accuracy of the XFEM and a sensitivity study examining the relationship between crevice geometry and species concentrations is presented to demonstrate the robustness of the XFEM formulation in handling complex corrosion interface morphologies.