  Context. The properties of dust grains, in particular their size
distribution, are expected to differ from the interstellar medium to the
high-density regions within molecular clouds. Since the extinction at
near-infrared wavelengths is caused by dust, the extinction law in cores should
depart from that found in low-density environments if the dust grains have
different properties. Aims. We explore methods to measure the near-infrared
extinction law produced by dense material in molecular cloud cores from
photometric data. Methods. Using controlled sets of synthetic and
semi-synthetic data, we test several methods for linear regression applied to
the specific problem of deriving the extinction law from photometric data. We
cover the parameter space appropriate to this type of observations. Results. We
find that many of the common linear-regression methods produce biased results
when applied to the extinction law from photometric colors. We propose and
validate a new method, LinES, as the most reliable for this effect. We explore
the use of this method to detect whether or not the extinction law of a given
reddened population has a break at some value of extinction.
