Programmers - the legalities of duplicating comercial code?

I realise this is a sensitive issue, but my question is about doing the right thing with something that is an existing piece of intellectual property.

I want to hire someone to write from scratch a Wordpress theme. The basis for the new Theme is an existing commercial product.

Obviously the quick way to do this would just be to take the existing code and duplicate it with some small changes.

Thats not what I am proposing, as it would be taking someone elses work and, effectively stealing it.

So my question is, what are the legalities involved in taking something that exists and adapting it into a new product to be used in a commercial venture?

How do I ensure the coder that I hire has done the right thing and created the work from scratch rather than lifting code from someone else’s work?

Im assuming also that the finished product would also need to show some differences from the original, in order to be considered NOT an exact duplicate. Can anyone shed light on the specifics of how this would need to be implemented?

Obviously this is something I have no understanding of, which is why I am seeking advice. My main concern is the legalities and ethics of taking an existing product and adapting it for resale.

Any advice or input would be appreciated.