Banks can and do assign mortgages that are in default. This is a common practice, particularly when lenders transfer distressed loans to specialized servicers, investors, or other entities better equipped to handle workouts, collections, or foreclosure proceedings. For example, after a default, a lender might sell or assign the note at a discount to avoid managing the issue themselves, especially if they lack the resources or anticipate further deterioration.
Regarding your scenario with the foreclosure of a second (junior) mortgage: No, you cannot assume the first (senior) mortgage was in good standing simply because it was assigned 6 months ago. The assignment alone does not imply the loan's payment status, as defaulted loans are routinely assigned.
To determine the actual status, you would need to review payment histories, lien records, or contact the current servicer—factors like this are critical in junior lien foreclosures, as the property would remain subject to the senior mortgage. Consult a real estate attorney or title company for property-specific due diligence.