In this article, the network-based iterative learning guaranteed cost control problem for the linear systems subject to denial-of-service (DoS) attacks at input and output (I/O) sides is studied via faded channels. First, the DoS attacks are modeled by independent Bernoulli sequences, where the expectation and variance are known. The fading measurements in I/O channels are described as independent Gaussian distributions with known expectations and variances respectively. Then, the repetitive system and the proposed ILC scheme involving both the iteration and time axes are transformed into a random two-dimensional (2D) Roesser model by using the 2D system theory. The mean-square asymptotic stability is introduced and followed by the definition of guaranteed cost function. Next, sufficient conditions that can not only ensure the asymptotic stability but also the cost index are derived. By applying the linear matrix inequality technology, the gain matrices and the upper bound of the control cost are further obtained. After exploring the adverse effect brought by the random fading phenomenon, a compensation algorithm is then designed and the analysis is strictly deduced. Finally, an injection molding process example is given to confirm the validity of the design.