The stability of oil wells is conventionally analyzed using analytical solutions that are often not suitable for modeling fractured media due to assumptions of continuous medium.This work has as main objective to develop a computational method for generating mud window using a numerical solution, suitable for fractured media.The software chosen for this work was the UDEC (Universal Distinct Element Code), which is based on discrete element method (DEM).This method considers the rock mass as the union of blocks of intact rock jointed by fractures, and whose physical behavior for each element can be analyzed individually.Computational modeling in UDEC was carried out in a coupled hydromechanical analysis.This modeling allowed to evaluate the influences of some of the mechanisms that govern the stability of wells, as in situ stresses, pore pressure and orientation, spacing and persistence of families of fractures.Numerical results show the effect of fracture orientation and magnitude of the stresses, besides the magnitude of the pore pressure resulting in more realistic calculations of lower collapse and upper fracture of the rock mass.