The geological environment determines the initial content of various elements in soil, while the late input of toxic elements produced through weathering and leaching is a persistent threat to food security and human health. In this study, we selected the Lou Shao Basin, a black rock system background, and combined geostatistical analysis and multivariate statistics to quantify the specific contribution of weathering of the black rock system, and to analyze the source traces, spatial distributions, and ecological risks of the soil toxicity of elements. The results show that the soils in the study area are acidic, which is related to the weathering of sulfides in the black rock system. The concentrations of most elements in the soil were determined to exceed the soil background values, and the Cd, Se and N contents, exceeded more than five times, especially Se, Mo nearly as high as 13 times. Strong positive correlation between Se, Cu, V and P, low correlation between N and Se, Cu, V, P, Ni and Cd.72.52%, 43%, 77.79%, 82%, 77%, and 44.1% of Cd, Se, Ni, Cu, B, and Mo came from the black rock system, respectively, which were greatly affected by geogenic weathering; V, Zn, Pb, and As are mainly from biomass burning sources; N and P are mainly from agricultural surface sources. Comparison found that the Cd and Se elements in the rocks in the study area were 16.78 times and 1.36 times higher than the world shale average, respectively, and need to pay attention to the weathering process of the two, and the spatial distribution of the 12 elements in soils showed a striped and centralized block distribution pattern, specifically around the distribution of carbonate and metamorphic rocks and other high-geology blocks. The ecological risk results showed that Cd was the main element causing high ecological risk, followed by Se and N, which were at moderate to high ecological risk levels, and Se and N showed similar ecological risk patterns, which may be related to the fact that selenium can promote the uptake and transformation of nitrogen. The present results add to the endogenous sources of toxic elements, quantify the source contributions of toxic elements in soils with high geologic backgrounds, fill this knowledge gap, and provide new insights for pollution control and ecological protection in areas with high geochemical backgrounds.