We present the photometric analysis of three ultra-short-period total eclipsing binaries in contact configuration, CRTS_J172718.0+431624, OGLE-BLG-ECL-000104, and OGLE-BLG-ECL-000012, mined from massive astronomical surveys. Using the available archival light curves (LCs) from Vista Variables in the Vía Láctea (VVV), Optical Gravitational Lensing Experiment (OGLE), Zwicky Transient Facility, and Catalina Sky Survey in different passbands and new multiband photometric observations with the 2.3 m Aristarchos telescope at Helmos Observatory, their relative physical parameters were derived. We explored the parameter space by using the PIKAIA genetic algorithm optimizer. The best photometric solution and error budget estimation were adopted for each system through Markov Chain Monte Carlo sampling of the global optimum. The approximate absolute parameters were derived for each contact system adopting an empirical mass-luminosity relation. All three systems have a mass ratio lower than 0.5. The exchange between the primary and secondary depths of CRTS_J172718.0+431624 during 2016-2022 may be due to spot activity. In addition, we present a detailed analysis of the first well-characterized shortest-period contact eclipsing binary with total eclipses known so far (OGLE-BLG-ECL-000104). Thanks to VVV and OGLE LCs, new distances were derived for OGLE-BLG-ECL-000104 and OGLE-BLG-ECL-000012 using empirical period-luminosity relations. The origin and evolutionary status of all three ultra-short-period contact binaries are thoroughly discussed in the context of the detached binary formation channel.