Perhaps the undergound labs use cruder techniques of manufacture compared to pharmaceutical companies. It might be the case that underground labs ,while producing drugs that contain the active ingredient, often don't take the time and expense to remove undesirable or potentially harmful contaminants, impurities or by-products.
For instance, here is in an extract from CIBA's patent for an improvement the manufactue of 1-dehydro-17 oz-methyl-testosterone (dianabol) authored by Alfred Hunger and John Ziegler, from 1959.
The authors talk the presence of selenium impurities in the standard manufacture of the drug,highly undesirable in a pharmaceutical steroid, and how they have created a more efficient method, than the previous ones, for removing it.
"It has been found that 17a-methyl-testosterone can be converted in high yield to 1-dehydro-17 oz-methyl-testosterone, a highly active anabolic agent known under the generic name "methandrostenolone,'(dianabol) by treating the former with selenium oxide (or selenious acid) in the presence of a solvent or solvent mixture, such as, for example, a tertiary lower alkanol, e.g. tertiary amyl alcohol and the like, a lower alkane carboxylic acid, e.g. acetic acid and the like, or any other suitable solvent.
Despite all the advantages of the dehydrogenation method of 17a methyl-testosterone with selenium oxide (or selenious acid), the residual amounts of selenium, particularly of organically bound selenium, contaminating the resulting crude 1-dehydro-17 Cz-methyl testosterone, represent a serious drawback of this dehydrogenation method.
In view of its use as a therapeutical agent, the final product has to be virtually free from impurities, such as organically bound selenium, in order to comply with the required degree of purity. Although a major part of the selenium impurities in the crude product may be removed, for example, by filtration, adsorption and elution, recrystallization methods and the like, a certain amount of these undesired by-products still remain as contaminants and cannot be eliminated by the above-mentioned conventional methods. This amount is invariably in excess of the quantity of selenium tolerated in pharmaceutical com positions by health authorities. We have now found a simple and economical process for the removal of selenium impurities contaminating 1 dehydro-17 oz-methyl-testosterone obtained by dehydrogenating 17c-methyl-testosterone with selenium oxide or selenious acid, which comprises treating the crude 1 dehydro-17 cc-methyl-testosterone with hydrogen peroxide, separating the resulting acidic fraction from the neutral fraction, treating the neutral fraction with an adsorbent, and recovering the purified 1-dehydro-17a-methyl-testosterone. This procedure yields the desired 1-dehydro-17 oz methyl-testosterone virtually free from contaminating selenium impurities.
Surprisingly, the double bonds in the A-ring and/or the substituents attached to the 17-position of the 1-dehydro-17 oz-methyl-testosterone are not affected by the treatment with hydrogen peroxide, which is a strong oxidizing reagent; no degradation products are observed and the yields of pure material are excellent.
The crude 1-dehydro-17c-methyl-testosterone, which is obtained from the dehydrogenation of 17a-methyl-testosterone and is used as the starting material in the process of this invention, contains from about 1,000 to about 15,000 parts per million of organically bound selenium. Although a portion of this impurity may be removed by conventional methods, such as filtration of a solution of the crude product, adsorption on an adsorbent and subsequent elution, recrystallization and the like, such purification steps are not necessary prior to the process of the invention, and the crude material obtained from the de hydrogenation procedure can be used directly in the first step of the procedure of this invention."
https://patentimages.storage.googleapis.com/40/23/6a/b6cb062373bd95/US3048603.pdf