What does it mean to be free from all attachment to sin, even venial sin? How do you know when you have achieved this?Usually what is being referred to here is the desire, inclination or propensity to commit a particular sin. This remains as your attachment to sin, even after the sin has been forgiven. We are also "attached" to our sin to the degree to which we have failed to properly atone for the effects our sin has had upon the Body of Christ. These attachments are purged in Purgatory, so that the Son can present us to the Father without spot or wrinkle.
One would know that he is rid of these attachments, or at least ridding himself of them, in this life if he is no longer compelled to sin in ways he used to sin, and if he faithfully carries out the penances assigned to him in Confession and performs regular acts of charity and mortification.