@John Warren
The term "illegal" gets used a lot even by City Officials in their literature. There are true illegal units, dwelling units that were built with out permits and not built to any adopted building codes. And there are non-conforming units, units that were built with permits and conformed to zoning and building codes at the time of construction, but due to changes in zoning and building codes would no longer be considered legal if they were built today. The trick would be, having the ability to identify the two.
Obviously there is still a risk, I believe you can mitigate that by keeping a safe and well maintained unit.
Title 17 of the Chicago Municipal Code mentions non-conforming units. Title 17 defines the legality of units and is stated so directly on the application for a Certificate of Zoning Compliance.
I agree more with @Brie Schmidt, here is a portion of title 17 that would pertain more to dwelling units
17-15-0100 General.
17-15-0101 Scope. The regulations of this chapter govern nonconformities, which are lots, uses, developments or signs that were lawfully established but – because of the adoption of new or amended regulations – no longer comply with one or more requirements of this Zoning Ordinance.
17-15-0102 Intent. In older cities, such as Chicago, many buildings and uses that were established in compliance with all regulations in effect at the time of their establishment have been made nonconforming by zoning map changes (rezonings) or amendments to the Zoning Ordinance text. The regulations of this chapter are intended to clarify the effect of such nonconforming status and avoid confusion with illegal buildings and uses (those established in violation of zoning rules). The regulations are also intended to:
17-15-0102-A recognize the interests of landowners in continuing to use their property for uses and activities that were lawfully established;
17-15-0102-B promote maintenance, reuse and rehabilitation of existing buildings; and
17-15-0102-C place reasonable limits on nonconformities that have the potential to adversely affect surrounding properties or the community as a whole.
17-15-0103 Authority to Continue. Any nonconformity that existed on the effective dates specified in Sec. 17-1-0200 or any situation that becomes a nonconformity upon adoption of any amendment to this Zoning Ordinance, may be continued in accordance with the regulations of this chapter.
17-15-0104 Determination of Nonconformity Status. The burden of proving that a nonconformity exists (as opposed to a violation of this Zoning Ordinance) rests with the subject landowner.
17-15-0105 Repairs and Maintenance.
17-15-0105-A Nonconformities must be maintained to be safe and in good repair.
17-15-0105-B Incidental repairs and normal maintenance necessary to keep a nonconformity in sound condition are permitted unless otherwise expressly prohibited by this Zoning Ordinance.
17-15-0105-C Nothing in this chapter will be construed to prevent nonconformities from being structurally strengthened or restored to a safe condition in accordance with an order from the Commissioner of Buildings.
17-15-0106 Change of Tenancy or Ownership. Nonconforming status runs with the land and is not affected by changes of tenancy, ownership, or management.