An LDR (Light Dependent Resistor) sensor works on the principle of photoconductivity. When light falls on the surface of the LDR, the resistance of the LDR changes. This change in resistance is inversely proportional to the intensity of light falling on it.
Here's how it works in more detail: