Yes, packages can contain “maintainer scripts” which are run before and/or after installation. You can see the scripts, if any, by extracting the control archive from the package:
dpkg-deb --ctrl-tarfile package-name.deb > control.tar
tar tf control.tar
or, if you know you want to extract the control archive’s contents:
dpkg-deb -e package-name.deb package-control
(which places the extracted files in a directory named
They run as root and can do whatever the package author wants on your system.
You should really consider that installing a package is equivalent to granting the maintainer (and anyone else involved in the package’s maintenance and build) root access to your system. Who do you trust?