The chromium portion of the stainless steel must be provided with oxygen to form a protective oxide layer state. The atmosphere normally provides a sufficient amount of oxygen to the stainless steel to maintain this passive oxide layer. When stainless steel is submerged it may not receive the oxygen that is required for it to remain passive (non-corrosive).
Any reduction in oxide protection along the stainless steel surface causes it to become anodic, or active. Meanwhile, the areas surrounding the active parts of the metal surface that still contain sufficient oxide protection act cathodic, and remain passive. Fresh water or seawater, being the electrolyte, provides the path for the ions of the anodic areas to transfer to the surrounding cathodic areas of the metal.
Galvanic attack continues over a period of time until a pit, or many pits form, while the surrounding metal remains virtually corrosion free. Meanwhile, the water inside the cavity-like pits becomes mildly acidic due to the increased concentration of hydrogen and chloride ions, which causes the rate of corrosion to become more aggressive. These pit sizes can range from pinholes to large, shallow depressions.
Crevice corrosion happens in a similar way. This can occur any place where the oxygen is depleted, either by dirt or grime, or where there is a seam such as a fastener.